Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in book? �range of numeric primitives�

 
Eric Richards
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic