Re: rounding numbers up
From: Tom N (tom_at_nospam.au)
Date: 02/26/04
- Next message: Ryan Stewart: "Re: rounding numbers up"
- Previous message: Ryan Stewart: "Re: rounding numbers up"
- In reply to: Ryan Stewart: "Re: rounding numbers up"
- Next in thread: Ryan Stewart: "Re: rounding numbers up"
- Reply: Ryan Stewart: "Re: rounding numbers up"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 26 Feb 2004 02:59:30 GMT
"Ryan Stewart" wrote
> "trs1800" wrote:
> > i tryed searching on this on google but i didnt find anything like i
> > wanted, how do i round a number up, like 1.39 to 2?
> >
> > Thanks paul
>
> I'm not aware of any standard methods that will do this for you. All you
> have to do though is add 0.5 and then use Math.round(). Alternately, add 1
> and use Math.floor(), cutting out the middleman as Math.round() adds 0.5
and
> calls Math.floor().
Math class also contains:
static double ceil(double a)
Returns the smallest (closest to negative infinity) double value
that is not less than the argument and is equal to a mathematical integer.
- Next message: Ryan Stewart: "Re: rounding numbers up"
- Previous message: Ryan Stewart: "Re: rounding numbers up"
- In reply to: Ryan Stewart: "Re: rounding numbers up"
- Next in thread: Ryan Stewart: "Re: rounding numbers up"
- Reply: Ryan Stewart: "Re: rounding numbers up"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|