Re: abs function
- Posted by Derek Brown <Cyrusbrown at AOL.COM> Jul 10, 1999
- 462 views
That's a pretty short way of doing it, but there is only one problem. When using atoms, finding the square and the square root of a number with lots of decimal places will cause it to lose accuracy. But, for integers, that way is good. This will keep the accuracy by only changing the sign if necessary: global function abs(atom x) if x < 0 then return 0 - x else return x end if end function Derek Brown