rounding up with < .5 ?

Subscriber subscriber at btopenworld.com
Thu Mar 14 17:49:01 EST 2002


Not sure just adding 0.5 would give the required result (if I understand the
problem correctly).
ie
 tresult=round(x+0.5)

With three examples for x say 3.9, 4.0, and 4.1
tresult returns 4, 5 and 5

As the middle number is an integer then I'd guess it doesn't need rounding
up, so the required results should be 4,4,5. Unless I missed something....

Please see my other post relating to TRUNC.

Regards

Gary Rathbone

----- Original Message -----
From: "Yates, Glen" <JAMES.G.YATES at saic.com>
To: <use-revolution at lists.runrev.com>
Sent: Thursday, March 14, 2002 9:58 PM
Subject: RE: rounding up with < .5 ?


> If you always want to round up, why not just add 0.5 to the number you are
> rounding?
>
> -Glen
>
> > I'd like to round 5.2 up to 6.  Neither round or statround
> > seem to allow me
> > to do this. For both, using precision 0 gives me 5, -1 gives
> > me 10 and 1
> > gives me 5.3.  (I do understand the difference between the two)
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list