• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

K&B chapter6 examwatch doubt

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
given:
The floor()and ceil()methods take only doubles. There are no
overloaded methods for integral numbers, because the methods would just
end up returning the integral numbers they were passed. The whole point
of floor()and ceil()is to convert floating-point numbers (doubles),
to integers, based on the rules of the methods. It may seem strange (it does
to us) that the integer values are returned in a double sized container, but
don�t let that throw you.

what the author is trying to say.please help since i don't get.
simple example would be very helpful.
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What the author is saying is that they don't know why the developers made the output of the floor() and ceil() methods double and not int.

The purpose of floor() is to return the value of the mathematical operation greatest integer, [x].

ceil() is going to return the value of the mathematical operation, [x] + 1.

The author is warning you not to get confused because the output of the methods are double.
 
please buy this thing and then I get a fat cut of the action:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic