JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings
David Chase
david.r.chase at oracle.com
Thu Sep 12 14:37:46 UTC 2013
On 2013-09-12, at 8:18 AM, Dmitry Nadezhin <dmitry.nadezhin at gmail.com> wrote:
> The reason while binary and decimal digits are mixed can be ullustrated by
> such example.
> It is necessary 3 decimal fraction digits to represent exactly pbinary
> power pow(2,-3) :
> pow(2,-3)=1/8=0.125
>
>
> On Thu, Sep 12, 2013 at 3:57 PM, David Chase <david.r.chase at oracle.com>wrote:
>
>> This explanation seems to combine numbers of binary digits (1075)
>> and numbers of decimal digits (17), and therefore makes me a little
>> nervous, though I think 1100 is a conservative choice that, even if not
>> 100% correct, will be 99.(over 700 9s)% correct.
>>
>> David
Yes, but you are adding them. It is as if you took two lengths, 1075 feet and 17 yards, added them, rounded up, and said that 1100 yards will be adequate (which is entirely true, though perhaps overconservative). Overconservative is okay.
2^-1075 is the binary ulp, give or take a fencepost, not the decimal ulp.
David
More information about the core-libs-dev
mailing list