• 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

range of float and double

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it positive infinity to negative infinity?
Than how can it fit in into 32 bit and 64
bits?
 
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sanjay,
range of Float and double can be found by running the following program.
--------------------------------------------------------
class MaxMin
{
public static void main(String j[])
{
System.out.println("Max Float :"+Float.MAX_VALUE);
System.out.println("Min Float :"+Float.MIN_VALUE);
System.out.println("Max Double :"+Double.MAX_VALUE);
System.out.println("Min Double :"+Double.MIN_VALUE);
}
}
--------------------------------------------------------
Now POSITIVE_INFINITY and NEGATIVE_INFINITY are two constants defined by Float and double classes which are used to handle overflow and underflow conditions.as soon as it seems that the value assigned to float /double is going to be greater than MAX_VALUE or less than MIN_VALUE then java uses two infinity constants and neatly saves us from an exception.
regards
deekasha
 
reply
    Bookmark Topic Watch Topic
  • New Topic