Re: simple eurphoria question

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu