#nint()
6 messages in this thread
A (probably) real simple question. I can't find my AREXX manual and I'm
trying to figure out the nint() function. I think my manual is on the
living room floor, but so is every thing else. The 2.04 manual and the
Abacus book say nothing (that I could find) on the subject. Does it just
give the whole number of a number, chopping off the remainder? And what
does the 'n' stand for? Natural int?
Thanks, Mike
Mike,
never heard of that function, but, if you'd like a nice INT function, try
this:
you have a number, lets say it's a float or MAY be a float:
parse var number intpart '.' fracpart
the variable "intpart" will have the integer portion in it, and (if there
WAS a fractional portion) "fracpart" will have the fractional part in it.
If it's important to know about the fractional part, put this line in there
too:
if fracpart = '' then fracpart = '.0'; else fracpart = '.'||fracpart;
:^)
–Ben
I was always partial to x%1, although the integer division may be slower
than string parsing.
In ARexx, it probably is. Because ARexx is a string language; everything is
a string. I *suspect* that the string solution is faster. Maybe Bill Hawes
will step in here and give us the scoop. :^)
–Ben
I didn't see the original message, so I'm not sure what you're asking.
There isn't a nint() function in REXX or ARexx, if that's the issue …
-Bill
Michael,
I'm not surprised you didn't find anything on nint() in the docs or the
Abacus book. I've been using Arexx since it first arrived, and I'm pretty
sure I've never seen it.
Where did you see a reference to it?
-larry