Skip to content
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

export sigexp() #130

Closed
jmkuhn opened this issue May 18, 2020 · 0 comments · Fixed by #138
Closed

export sigexp() #130

jmkuhn opened this issue May 18, 2020 · 0 comments · Fixed by #138

Comments

@jmkuhn
Copy link
Contributor

jmkuhn commented May 18, 2020

sigexp(x::DecimalFloatingPoint) is an internal function that returns (significand:IntXX, exponent::Int). The returned significand is always >= 0. When I use this function I have already checked for NaN and Inf so this internal version doesn't return useful values if passed NaN or Inf.

I suggest exporting a modified version of this that returns (sign::DecXX, significand::DecXX, exponent::Int)

julia> sigexp(d64"-1.234")
(-1.0, 1234.0, -3)

julia> sigexp(d64"NaN")
(NaN, NaN, 0)

julia> sigexp(d64"-Inf")
(-1.0, Inf, 0)

An alternative would be to have it return (sign::Int, significand::IntXX, exponent::Int) and throw an exception if passed NaN or Inf.

@quinnj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant