-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Rounded
option in the normalize
function
#36
Comments
Merged
barucden
added a commit
to barucden/Decimals.jl
that referenced
this issue
Nov 6, 2024
The PR replaces `round` and `normalize`. Fixes JuliaMath#27 Fixes JuliaMath#36 Fixes JuliaMath#39 Fixes JuliaMath#50
barucden
added a commit
to barucden/Decimals.jl
that referenced
this issue
Nov 7, 2024
The PR replaces `round` and `normalize`. Fixes JuliaMath#27 Fixes JuliaMath#36 Fixes JuliaMath#39 Fixes JuliaMath#50
barucden
added a commit
to barucden/Decimals.jl
that referenced
this issue
Nov 7, 2024
The PR replaces `round` and `normalize`. Fixes JuliaMath#27 Fixes JuliaMath#36 Fixes JuliaMath#39 Fixes JuliaMath#50
barucden
added a commit
to barucden/Decimals.jl
that referenced
this issue
Nov 7, 2024
The PR replaces `round` and `normalize`. Fixes JuliaMath#27 Fixes JuliaMath#36 Fixes JuliaMath#39 Fixes JuliaMath#50
barucden
added a commit
to barucden/Decimals.jl
that referenced
this issue
Nov 7, 2024
The PR replaces `round` and `normalize`. Fixes JuliaMath#27 Fixes JuliaMath#36 Fixes JuliaMath#39 Fixes JuliaMath#50
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
I am checking the code for the
normalize
function at https://github.com/JuliaMath/Decimals.jl/blob/master/src/norm.jl and I suspect there are two problems in how therounded
option is handled.First, the code on line 12 is run if
rounded
is set totrue
. But clearly this line computes the output without rounding. It is only theelse
branch that does something containing rouding. I suspect the logic here is inverted.Second, on line 14, where rounding is performed, the
digits
parameter is set toDIGITS
. But it is unclear to me where thisDIGITS
comes from - it is not entered while calling thenormalize
function. Is it intended to be a global variable? EDIT: I see, it is aconst
set in the module to 20. It does not work anyway as I would anticipate. The code below:For comparision with a standard float:
I am running this in REPL.
The text was updated successfully, but these errors were encountered: