Results 1 to 2 of 2
  1. #1
    teardrop3903 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default Ceiling and Floor without using Math class

    Is there a way to find the ceiling or floor of a float for example

    4.5 -> 4 for floor
    4.5 -> 5 for ceiling

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default Re: Ceiling and Floor without using Math class

    I'm guessing this is for an assignment (otherwise the no Math is a weird requirement). You could peek at the Math.java source. Or consider what foo%1 is when foo is a floating point type.

Similar Threads

  1. help with math class and random numbers
    By NestorPrime in forum New To Java
    Replies: 9
    Last Post: 10-01-2011, 10:57 PM
  2. Performing Exponentiation in Java without the Math Class
    By BlueJ Coder in forum New To Java
    Replies: 9
    Last Post: 10-14-2009, 09:48 PM
  3. Math Class
    By ritwik07 in forum New To Java
    Replies: 2
    Last Post: 09-14-2009, 05:06 PM
  4. Math class question
    By shendel in forum New To Java
    Replies: 1
    Last Post: 03-05-2009, 01:06 PM
  5. Math Class (ceil, floor, abs)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-13-2007, 10:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •