what is wrong with Math.ceil
From: wheresjim (wheresjim_at_gmail.com)
Date: 10/13/04
- Next message: Ann: "Re: open MS Word in IE and save it to the server"
- Previous message: Ann: "Re: fortran with Java?"
- Next in thread: Carl Howells: "Re: what is wrong with Math.ceil"
- Reply: Carl Howells: "Re: what is wrong with Math.ceil"
- Reply: Ann: "Re: what is wrong with Math.ceil"
- Reply: The Abrasive Sponge: "Re: what is wrong with Math.ceil"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 13 Oct 2004 11:13:30 -0700
I think I am going crazy. I have used Math.ceil many times to round up
a number, and for some reason I cannot make it work properly today.
The following code:
public class MathTest
{
public static void main(String args[])
{
System.out.println(Math.ceil(40/15));
}
}
Produces this output:
2.0
Should it not take the result (2.6666666666666666666666666666667
according to my Microsoft calculator) and round it up to 3?
- Next message: Ann: "Re: open MS Word in IE and save it to the server"
- Previous message: Ann: "Re: fortran with Java?"
- Next in thread: Carl Howells: "Re: what is wrong with Math.ceil"
- Reply: Carl Howells: "Re: what is wrong with Math.ceil"
- Reply: Ann: "Re: what is wrong with Math.ceil"
- Reply: The Abrasive Sponge: "Re: what is wrong with Math.ceil"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|