Re: Rounding (unusually)

2002-06-10 Thread roy crisman
This is called a Ceiling function. The opposite, where you want to lop off the non-integer part is called a Floor function. Looking in my Math library of code, I see that my Floor and Ceiling functions aren't correct, so let's see I just leveraged the working Floor function to create the

Re: Rounding (unusually)

2002-06-05 Thread bhakti
if x > integer(x) then x = x+1 Colin Holgate wrote: > > >put integer(1.9 + 0.5) > >-- 2 > > > >Regards, > >Pranav Negandhi > > Unfortunately that would not work out: > > put integer(1.0 + 0.5) > -- 2 > > The goal was to let 1.0 be 1. > > Here's something that does work, but I feel sure there

Re: Rounding (unusually)

2002-06-05 Thread pranavn
Hows this? :-) n = 4.1 z = (n - integer(n - 0.5)) put n - (n - integer(n-.5)) + (z > 0) -- 5. Works like a charm, Colin. Just for the heck of it I went through it all. Took a while to make out though. I removed the multiplication with the boolean result at the end. I think it's redundant.

Re: Rounding (unusually)

2002-06-05 Thread Fumio Nonaka
Simpler? put integer(n + .5) - (integer(n) = n) _ Colin Holgate wrote: > The goal was to let 1.0 be 1. > > Here's something that does work, but I feel sure there's something > simpler (it can be simpler in two lines, but just for the fun of it > I'm trying one line): > > put n - (n - integer

Re: Rounding (unusually)

2002-06-05 Thread rdantas
Sent by:cc: [EMAIL PROTECTED] Subject: Re: Rounding (unusually)

Re: Rounding (unusually)

2002-06-05 Thread Colin Holgate
>put integer(1.9 + 0.5) >-- 2 > >Regards, >Pranav Negandhi Unfortunately that would not work out: put integer(1.0 + 0.5) -- 2 The goal was to let 1.0 be 1. Here's something that does work, but I feel sure there's something simpler (it can be simpler in two lines, but just for the fun of it

Re: Rounding (unusually)

2002-06-04 Thread pranavn
put integer(1.2 + 0.5) -- 2 put integer(1.6 + 0.5) -- 2 put integer(1.9 + 0.5) -- 2 Regards, Pranav Negandhi I'd like to round a number the following way. 1.2 would round up to 2 1.9 would round up to 2 1.99 would still round to 2 [To remove yourself from this list, or to change to

Rounding (unusually)

2002-06-04 Thread Brendon Gearin
A little stuck on this.. I'd like to round a number the following way. 1.2 would round up to 2 1.9 would round up to 2 1.99 would still round to 2 Basically if its over the whole of the number it needs to go to the next whole number. Any ideas? Cheers Brendon [To remove yourself from this