Skip to content

Add a note about the precision of double in Javadoc of JsonDouble - #13

Open
dmikurube wants to merge 1 commit into
JsonDouble-equals-plus-0.0-minus-0.0from
JsonDouble-JsonLong-precision-comment
Open

dmikurube wants to merge 1 commit into
JsonDouble-equals-plus-0.0-minus-0.0from
JsonDouble-JsonLong-precision-comment

Conversation

@dmikurube

Copy link
Copy Markdown
Member

No description provided.

@dmikurube
dmikurube requested a review from a team as a code owner October 8, 2026 14:59

@hiroyuki-sato hiroyuki-sato left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM👍

* and for the future possibility to accept {@code NaN} and the infinity.
*
* <p>Note that a {@link JsonDouble} instance cannot represent every integral number whose absolute value is greater than
* 2<sup>53</sup>. For such a large number, {@link #longValue()}, {@link #bigIntegerValue()}, {@link #bigDecimalValue()},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

I think it would be helpful to add a comment like the following, as readers might wonder why 2^53 is the threshold (as I did).

/**
 * <p>Note that IEEE 754 double-precision floating-point numbers (binary64)
 * have 53 bits of significand precision. Therefore, a {@link JsonDouble}
 * instance cannot represent every integer whose absolute value is greater
 * than 2<sup>53</sup>.

*/

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants