-
Notifications
You must be signed in to change notification settings - Fork 33
Generic frexp
#150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Generic frexp
#150
Conversation
Codecov Report
@@ Coverage Diff @@
## master #150 +/- ##
==========================================
+ Coverage 48.75% 48.87% +0.11%
==========================================
Files 63 63
Lines 3425 3429 +4
==========================================
+ Hits 1670 1676 +6
+ Misses 1755 1753 -2
Continue to review full report at Codecov.
|
seems reasonable -- it is breaking though. thoughts? |
I guess it's your call whether to call it a bugfix :) No rush from me, certainly not worth 2.0. You would have to depend on this package to be relying on the old behaviour. None of the direct packages in General seem to. What people do in private I don't know. From Juliahub, list of deps: Packages which do use or define https://github.com/StevenWhitaker/BlochSim.jl/blob/f5a353867c2b08c2e40b6737e97586dad8882581/src/expm.jl#L200-L212 https://github.com/JuliaPhysics/Measurements.jl/blob/b26fbff340f6a9c1432a06c8941ff9ba9a0ca34f/src/math.jl#L580-L583 https://github.com/PainterQubits/Unitful.jl/blob/960e09ef518b0d3ff54747460b9c3872c08df0d7/src/quantities.jl#L467-L470 |
Applies `Base.frexp` to both `hi` and `lo` parts, and returns a tuple of tuples. | ||
See also `DoubleFloats.ldexps` for the inverse, and `DoubleFloats.signs` similar tuple. | ||
""" | ||
function frexps(x::DoubleFloat{T}) where {T<:IEEEFloat} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of an awful name, trying to match signs
. Could be more explicit like double_frexp
or something.
It would be great if you could merge this PR, I just had a bug because significand(x::DoubleFloat{T}) where {T<:IEEEFloat} = frexp(x)[1] * 2
function exponent(x::DoubleFloat{T}) where {T<:IEEEFloat}
!isfinite(x) && throw(DomainError("Cannot be NaN or Inf."))
iszero(x) && throw(DomainError("Cannot be ±0.0."))
return frexp(x)[2] - 1
end and everything would work as expected. IMHO this is a bugfix, and bugfixes are never breaking. |
Implements roughly this idea: #148 (comment)