Page 1 of 1

getting the decimal part of a number

Posted: November 25th, 2020, 6:43 am
by AriSilva
Is there an easy way to get that?
For example:
i = 23.45678;
j = fn(i);
j would be .45678

I´m using now a maketext to string, then string to number and then a subtraction, like:
i = 23.456789;
x = maketext("%7.0f", i);
j = tonumber(x);
k = i - j;

Re: getting the decimal part of a number

Posted: November 25th, 2020, 8:54 am
by Gregory Martin
How about using the int function:
numeric decimal_part = value - int(value);

Re: getting the decimal part of a number

Posted: November 26th, 2020, 4:38 pm
by AriSilva
Gee,
I swear I´ve went down all over the alphabetical list of functions and did not see it.
Thanks Greg