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

fix(#74): use normalized notation on toStringAsExponential #73

Merged
merged 3 commits into from
Apr 19, 2022
Merged

fix(#74): use normalized notation on toStringAsExponential #73

merged 3 commits into from
Apr 19, 2022

Conversation

canastro
Copy link
Contributor

@canastro canastro commented Apr 13, 2022

A few releases ago Decimal was using Doubles to perform toStringAsExponential:

toDouble().toStringAsExponential(fractionDigits); 

This approach seems to use the normalized scientific notation, ie: given dec('9.9999e+7').toStringAsExponential(2) it would output 1.00e+8.

With the current implementation that same input will return 10.00e+7.

Let me know if you consider this a bug and its a fix you want to merge.

Fixes #74

@canastro canastro changed the title refactor: use normalized notation on toStringAsExponential fix(#74(: use normalized notation on toStringAsExponential Apr 13, 2022
@canastro canastro changed the title fix(#74(: use normalized notation on toStringAsExponential fix(#74): use normalized notation on toStringAsExponential Apr 13, 2022
@a14n
Copy link
Owner

a14n commented Apr 19, 2022

Thanks for the report and this fix !

@a14n a14n merged commit d4cc54c into a14n:master Apr 19, 2022
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 this pull request may close these issues.

Different results from toStringAsExponential in double and in decimal
2 participants