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

Method BigDecimal: 0 digits algorithm #208

Open
BurdetteLamar opened this issue Nov 27, 2021 · 2 comments
Open

Method BigDecimal: 0 digits algorithm #208

BurdetteLamar opened this issue Nov 27, 2021 · 2 comments
Assignees
Labels

Comments

@BurdetteLamar
Copy link
Member

Doc for method BigDecimal says:

  • When arg is a Float and digits is 0, the number
  • of digits is determined by the algorithm of dtoa function
  • written by David M. Gay. That algorithm is based on "How to Print Floating-
  • Point Numbers Accurately" by Guy L. Steele, Jr. and Jon L. White [Proc. ACM
  • SIGPLAN '90, pp. 112-126].

Is this also true for other methods that have digits/ndigits?

@mrkn
Copy link
Member

mrkn commented Nov 28, 2021

Your understanding is correct right now. But I don't want to mention the detail algorithm how to generate the decimal notation in the documentation because it is not the specification but an implementation detail.

The specification of the method BigDecimal is that it generates a decimal notation from a Float so that it can be converted back to the original number and it's number of digits is fewer than the other decimal notation candidates that can be converted back to the original. The number of digits may not be the fewest.

@BurdetteLamar
Copy link
Member Author

I have omitted the passge. Hope that's what you meant.

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

No branches or pull requests

2 participants