aspose file tools*
The moose likes Beginning Java and the fly likes Error in book?  �range of numeric primitives� Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error in book?  �range of numeric primitives�" Watch "Error in book?  �range of numeric primitives�" New topic
Author

Error in book? �range of numeric primitives�

Eric Richards
Greenhorn

Joined: Apr 30, 2007
Posts: 5
Here is a strange problem page 50 of �SCJP� by Kathy Sierra & Bert Bates
Table of �range of numeric primitives�

For float & double the �minimum range� and �maximum range� has got �n/a�

while in another book the range has
1.4E-45 to 3.4E+38 for float
and
4.9E-324 to 1.7E+308 for double

By the way I know this might said strange I have added on to the table
Boolean �true� of �false�
[ October 05, 2007: Message edited by: Eric Richards ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

Floating-point primitives (float and double) use IEEE 754 standards, and their range comes at the expense of precision. These details are beyond the scope of the SCJP exam, so "n/a" is probably appropriate for a study guide.

(Also, note that float and double types can represent negative or positive infinity.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Eric Richards:
...By the way I know this might said strange I have added on to the table
Boolean �true� of �false�

Keep in mind that Java boolean types are not "numeric." Unlike some languages, you cannot treat these as zeros and ones. Also, the size of a Java boolean is not specified.
Eric Richards
Greenhorn

Joined: Apr 30, 2007
Posts: 5
yes it is just that each time I look at the table, it reminds me, to use true or false for boolean and not 1 or 0.

Originally posted by marc weber:

Keep in mind that Java boolean types are not "numeric." Unlike some languages, you cannot treat these as zeros and ones. Also, the size of a Java boolean is not specified.
Eric Richards
Greenhorn

Joined: Apr 30, 2007
Posts: 5
What a pity some comment like this was not added to the book, I thought it was strange it should be n/a so I had to waste time looking somewhere else.

Originally posted by marc weber:
Welcome to JavaRanch!

Floating-point primitives (float and double) use IEEE 754 standards, and their range comes at the expense of precision. These details are beyond the scope of the SCJP exam, so "n/a" is probably appropriate for a study guide.

(Also, note that float and double types can represent negative or positive infinity.)
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Eric Richards:
What a pity some comment like this was not added to the book...

Well, on page 51, they say...
The range for floating-point numbers is complicated to determine, but luckily you don't need to know these for the exam...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in book? �range of numeric primitives�