rounding up with < .5 ?

Subscriber subscriber at btopenworld.com
Thu Mar 14 17:32:00 EST 2002


Check out the trunc function. It only returns the integer part of a number.

if trunc(x)=x then                    --check the number is an integer
    return x
else
    return (trunc(x)+1)             -- if not then return the next integer
above
end if

I hope this is what you're after !

Regards
Gary Rathbone


----- Original Message -----
From: "Zac Elston" <zelston at aol.com>
To: <use-revolution at lists.runrev.com>
Sent: Thursday, March 14, 2002 9:44 PM
Subject: rounding up with < .5 ?


> 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)
>
> Is there a way to check if a var is an int or float? and convert?
>
> I can see doing do char evals with
>
> set the itemdel to "."
> if the number of items in MyNumb >1 then
> put item 1 of MyNumb + 1 into MyRoundUpNum
> end if
>
> Maybe I'm going about this all wrong.  any pointers?
>
> thanks
>
> -zac
>
> _______________________________________________
> 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