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

Different results from toStringAsExponential in double and in decimal #74

Closed
canastro opened this issue Apr 13, 2022 · 1 comment · Fixed by #73
Closed

Different results from toStringAsExponential in double and in decimal #74

canastro opened this issue Apr 13, 2022 · 1 comment · Fixed by #73

Comments

@canastro
Copy link
Contributor

canastro commented Apr 13, 2022

A few releases 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.

@a14n a14n closed this as completed in #73 Apr 19, 2022
a14n added a commit that referenced this issue Apr 19, 2022
* refactor: use normalized notation on toStringAsExponential

* remove unnecessary round

* clean up

Co-authored-by: Alexandre Ardhuin <[email protected]>
@a14n
Copy link
Owner

a14n commented Apr 19, 2022

Fix available in 2.2.0

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.

2 participants