Re: rounding numbers up

From: Tom N (tom_at_nospam.au)
Date: 02/26/04


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.



Relevant Pages

  • Re: rounding numbers up
    ... > i tryed searching on this on google but i didnt find anything like i ... > Thanks paul ...
    (comp.lang.java)
  • Re: What did I get myself into?-conclusion
    ... Congrats on the gig. ... I was sweating blood for you. ... Paul wrote: ... great music that I didnt know about. ...
    (rec.music.makers.guitar.jazz)
  • Re: What did I get myself into?-conclusion
    ... Paul wrote: ... like Joey said, the Bass player wasn't just playing ... consisted in hitting the chords on the downbeats, ... great music that I didnt know about. ...
    (rec.music.makers.guitar.jazz)
  • Re: Google acting strange ?
    ... >Paul B wrote: ... google has gone ga-ga. ... >I have also notice caps vs non caps oddities also. ...
    (alt.internet.search-engines)
  • Re: "Help me . . . my car doors wont unlock."
    ... I have at least mastered the basics of Google and as ... BMW and your inability to fathom your own car's central locking facility. ... When I unlock via the remote key, the Central locking only unlocks drivers ... Paul " ...
    (alt.guitar)