• 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

Double Puzzle!

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all..
could u pls tell me how does the following code work??
double c = Math.floor(Double.MIN_VALUE); //gives a result of 0.0

double c = Math.ceil(Double.MIN_VALUE); //gives a result of 1.0

thanx..

------------------
Hima
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hima.Double.MIN_VALUE will give the smallest number in double precision greater than 0.Hence floor(Double.MIN_VALUE) will return,as a double,the nearest integer value to Double.MIN_VALE,which is 0.0.
Same explanation can be extended for ciel(Double.MIN_VALUE).
I hope that helps.

------------------
Udayan Naik
Sun Certified Programmer for the Java 2 Platform
 
Hima Mangal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Udayan..
thanx for the reply.. but i still don't understand the logic behind it.. could u pls elaborate or maybe lead me to some article that explains it?
thanx again..
------------------
Hima
reply
    Bookmark Topic Watch Topic
  • New Topic