• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ranges

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the exam, do we need to remember by heart all the min. and max. values for all the data types?
 
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well not exactly, you can memosize short and byte values because they are easy. But for the other datatypes it is enought to know that
integer range is from -2^32 to 2^(32-1)
long range is from -2^64 to 2^(64-1)
....
Hope this helps.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes
byte 2^8
Char
Boolean : true / false
Short: - 2^16 to 2^16 -1
Int : - 2^32 to 2^32-1
Long : - 2^64 to 2^64
Float: 2^32-1
double: 2^64
 
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Yes
byte 2^8
Char
Boolean : true / false
Short: - 2^16 to 2^16 -1
Int : - 2^32 to 2^32-1
Long : - 2^64 to 2^64
Float: 2^32-1
double: 2^64


Hi Xara, your ranges are not accurate.
 
Xara Mithra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yikes..you are absolutely right
fixed
byte -2^7 -> 2^7 - 1
Char
Boolean : true / false
Short: - 2^15 to 2^15 -1
Int : - 2^31 to 2^31-1
Long : - 2^63 to 2^63-1
what about float and double..what ranges does it take?
 
Vicken Karaoghlanian
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My appologies to geeta and Xara i mislead you with my first post.
here are the accurate dataype ranges.
byte = -2^7 to 2^(7-1)
short = -2^15 to 2^(15-1)
int = -2^31 to 2^(31-1)
long = -2^63 to 2^(63-1)
float = ... to ...
double = ... to ...
Note: the values for float and double are not required for the exam.
[ November 23, 2003: Message edited by: Vicken Karaoghlanian ]
 
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Xara has the right ranges.
(Vicken: 2^(63-1) = 2^62)
(btw char is given as 0x0 - 0xffff, or 0 to 2^16)
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess its not:
byte = -2^7 to 2^(7-1)
short = -2^15 to 2^(15-1)
int = -2^31 to 2^(31-1)
long = -2^63 to 2^(63-1)
float = ... to ...
double = ... to ...

but
byte = -2^7 to (2^7)-1
short = -2^15 to (2^15)-1
int = -2^31 to (2^31)-1
long = -2^63 to (2^63)-1
float = ... to ...
double = ... to ...
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Anish Doshi is right.
byte = -2^7 to 2^(7-1) and byte = -2^7 to (2^7)-1 are different.
Right values are
byte = -2^7 to (2^7)-1
short = -2^15 to (2^15)-1
int = -2^31 to (2^31)-1
long = -2^63 to (2^63)-1
Regards,
Hari
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic