|
Post by johnno56 on Mar 5, 2022 5:23:28 GMT -6
RC does not seem to have floor() or ceiling() functions. Does anyone know a method of simulating these functions using RC?
|
|
|
Post by rosy on Mar 5, 2022 6:41:04 GMT -6
int Round(long double X){ int INT=(long int)X; return X>=0 ? INT+(X-INT>=0.5):INT-(INT-X>=0.5);} This is a Round of my Basic C. Let's do it .. CEIL: I=int(x) If x>=0 then Return I+(x-I>0) Else Return I End If FLOOR: I=int(x) If x>=0 then Return I Else Return I-(I-x>0) End If
These 3 functions can be summarized in 1 with 3 parameters
|
|
|
Post by johnno56 on Mar 5, 2022 7:12:16 GMT -6
Thanks Rosy. Much appreciated.
|
|
|
Post by n00b on Mar 5, 2022 23:36:40 GMT -6
I will think about adding these in the future
|
|