This content has been marked as final.
Show 12 replies

1. Re: Need help with calculating floating point numbers in JAVA
EJP Dec 22, 2009 12:34 AM (in response to 807580)Can anyone please tell me which are the other numbers in JAVA which cannot be represented as floating point numbers.
That would be all the numbers that aren't expressible in binary floating point. You really want a list? It's pretty long! 
2. Re: Need help with calculating floating point numbers in JAVA
807580 Dec 22, 2009 4:07 AM (in response to 807580)SASPROGR wrote:
We can tell you which numbers CAN be represented in 64bit IEEE 754 floating point (Java double);
The reason being 4671.11 cannot be represented exactly in floating point.
Can anyone please tell me which are the other numbers in Java which cannot be represented as floating point numbers.
scalars up to 2 ^53^ and
fractions with a numerator up to 2 ^53^ and a denominator that is a power of 2. 
3. Re: Need help with calculating floating point numbers in JAVA
807580 Dec 22, 2009 7:30 AM (in response to EJP)ejp wrote:
∞
It's pretty long!
:o) 
4. Re: Need help with calculating floating point numbers in JAVA
807580 Dec 22, 2009 8:24 AM (in response to 807580)yawmark wrote:
Let J denote the set of numbers that CAN be represented in 64bit IEEE 754 floating point (Java double),ejp wrote:
∞
It's pretty long!
then the answer to the original question is a simple complement; R [\http://en.wikipedia.org/wiki/Set_%28mathematics%29#Complements] J 
5. Re: Need help with calculating floating point numbers in JAVA
dcminter Dec 22, 2009 8:27 AM (in response to 807580)[What Every Computer Scientist Should Know About FloatingPoint Arithmetichttp://docs.sun.com/source/8063568/ncg_goldberg.html] 
6. Re: Need help with calculating floating point numbers in JAVA
796262 Dec 22, 2009 8:28 AM (in response to 807580)SASPROGR wrote:
Why do people insist on writing Java in allcaps? Do they think it's an abbreviation? I don't know why, but this always grinds my gears...
Can anyone please tell me which are the other numbers in JAVA which cannot be represented as floating point numbers. 
7. Re: Need help with calculating floating point numbers in JAVA
dcminter Dec 22, 2009 8:34 AM (in response to 796262)Do they think it's an abbreviation?
Yep. Someone took a dozen posts of near incomprehensible broken English to ask what it stood for the other day. Probably not helped by the fact that Sun's stock ticker is JAVA all caps (I presume that'll go when Snoracle goes live).
Edited by: dcminter on 22Dec2009 14:33 
8. Re: Need help with calculating floating point numbers in JAVA
807580 Dec 22, 2009 8:38 AM (in response to dcminter)dcminter wrote:
Never figured that one out. Was Sun honestly not publicly traded before Java was released? Or did they actually change it from something else in a PR move?Do they think it's an abbreviation?
Sun's stock ticker is JAVA all caps (I presume that'll go when Snoracle goes live). 
9. Re: Need help with calculating floating point numbers in JAVA
dcminter Dec 22, 2009 8:59 AM (in response to 807580)Or did they actually change it from something else in a PR move?
They were SUNW before and changed it. One of two utterly fatuous things Sun did before the Oracle offer  the other being the purchase of MySQL for (pinkie to corner of mouth) one beellion dollars. 
10. Re: Need help with calculating floating point numbers in JAVA
807580 Dec 23, 2009 2:00 AM (in response to EJP)Can you please provide info over the list. Also, how you got to know these numbers .... if by computation or is it published.
Thanks. 
11. Re: Need help with calculating floating point numbers in JAVA
796440 Dec 23, 2009 2:19 AM (in response to 807580)SASPROGR wrote:
For numbers that can be represented, google IEEE 754.
Can you please provide info over the list. Also, how you got to know these numbers .... if by computation or is it published.
Thanks.
For numbers that cannot be represented, please understand that since double is 64 bits, at most 2^64 distinct values can be represented, and also please understand that between any two values that can be represented, there are uncountably infinitely many that cannot.
For instance, between the numbers
there are infinitely many numbers, and not only infinitely many, but "more infinitely many" than there are integers from 0 to infinity.0.0000000000000000000000000000000000000000_1_00000000000000000000000000000_0_ and 0.0000000000000000000000000000000000000000_1_00000000000000000000000000000_1_
Edited by: jverd on Dec 23, 2009 12:17 AM 
12. Re: Need help with calculating floating point numbers in JAVA
807580 Dec 23, 2009 5:25 AM (in response to 807580)SASPROGR wrote:
Other than what I already conveyed in [reply #2http://forums.sun.com/thread.jspa?messageID=10891841#10891841] and [reply #4http://forums.sun.com/thread.jspa?messageID=10892004#10892004]?
Can you please provide info over the list.Also, how you got to know these numbers .... if by computation or is it published.
It can be determined from the IEEE 754 spec.
[http://en.wikipedia.org/wiki/Double_precision_floatingpoint_format]
[http://babbage.cs.qc.edu/courses/cs341/IEEE754references.html]