Re: simple eurphoria question
- Posted by Larry Miller <larrymiller at sasktel.net> Dec 09, 2006
- 798 views
This function will find the integer portion of a negative number - most of the time:
if integer(x) then return x elsif x<0 then return floor(x+1) else return floor(x) end if
The problem is that integer(x) will return 0 for any number outside of Euphoria's integer range, even if it has no fractional component. The function above when used with -4000000000 will return -3999999999, which is wrong. This method is used in Ricardo Forno's General function library for FloorTowardsZero() and probably others. It should be corrected. Larry Miller