getting the decimal part of a number

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
Post Reply
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

getting the decimal part of a number

Post 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;
Best
Ari
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: getting the decimal part of a number

Post by Gregory Martin »

How about using the int function:
numeric decimal_part = value - int(value);
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: getting the decimal part of a number

Post by AriSilva »

Gee,
I swear I´ve went down all over the alphabetical list of functions and did not see it.
Thanks Greg
Best
Ari
Post Reply