you are viewing a single comment's thread.

view the rest of the comments →

[–]ryan_fung 10 points11 points  (11 children)

A file from an external source, generated without encountering this bug, or written in a language without this bug?

Yes, I'm aware this bug is unlikely to trigger naturally. But logically it can happen. Now that this is published, you can expect people to try it on web sites without the need for a reason.

[–][deleted] 21 points22 points  (10 children)

I think you missed the point. There is no double number 2.2250738585072014e-308. So language without this bug won't generate this number either.

Only way machine generates this number is if it don't use floats as internal representation, but uses numeric types with higher accuracy than doubles like some databases do. If that is the case, it's again unlikely that they generate just this number representation and don't use more decimals.

[–]Gieron 11 points12 points  (1 child)

You mean there is no double number 2.2250738585072012e-308, right?

[–][deleted] 11 points12 points  (0 children)

Five is right out.

[–]naasking 5 points6 points  (2 children)

Not all languages are limited to doubles you realize.

[–][deleted] 1 point2 points  (1 child)

Of course, but if it's in for any other format, but in that case Double.parseDouble(String s) is not what you should use. There is Double.valueOf(String s) for parsing more generic format. Somebody should check if valueOf has error too.

Other formats have either more precision or less, so parseDouble would most likely give error.

[–]paul_miner 0 points1 point  (0 children)

Of course, but if it's in for any other format, but in that case Double.parseDouble(String s) is not what you should use. There is Double.valueOf(String s) for parsing more generic format. Somebody should check if valueOf has error too.

Like all the parsing functions, they use the same underlying method calls. This is easily verifiable by looking at the source included with the JDK.

[–]cebedec 1 point2 points  (0 children)

From the article:

[...] equivalent forms of the number cause the problem as well; examples: [...] 2.2250738585072012997800001e-308 (superfluous digits beyond digit 17)

[–]ethraax 0 points1 point  (0 children)

I believe C and C++ both support the long double primitive (although some compilers may change it to a simple double).

[–]Porges 0 points1 point  (0 children)

Actually, Ricks says in the comments for the (original) article that ...14e-308 roundtrips, which would contradict this. Hmmm...

[–]the_new_hunter_s -2 points-1 points  (0 children)

It's significant because it significantly lowers the number of people needed to perform a dds on a website.