Re: something like 'abs()' ???
- Posted by irv mullins <irvm at ellijay.com> Jun 25, 2004
- 494 views
eel picton wrote: > > er... me again... > > i cant seem to find the equivalent of an 'abs' or 'absolute' function as found > in 'commodore > 64' basic etc... > > it is a function that returns the positive value of a number regardless of > whether > the original number is positive or negative > > i have got around this by taking the square root of the square of the > number... > > but is there a simpler way anyone knows of? (maybe i'm having another > brain-cell free > day) The EuForum archives are a good place to look up such things. One way: function abs(integer x) return x * ((x>0) - (x<0)) end function Regards, Irv