Re: ESL project Attn Jeremy Peterson
- Posted by Larry Miller <larrymiller at sasktel.net> Jan 20, 2006
- 486 views
There is a problem with the ceil() function in math.e The function uses the integer() function to determine if a number has a fractional component. This will give incorrect results for whole numbers outside Euphoria's integer range. A function that gives correct results is as follows:
-- Routine: ceil -- Syntax: a = ceil(x) -- Description: Rounds number towards positive infinity (opposite of Euphoria's floor()). global function ceil(object a) object t if atom(a) then return -floor(-a) else for i = 1 to length(a) do t = a[i] if atom(t) then a[i]=-floor(-t) else a[i]=ceil(t) end if end for end if return a end function
I appreciate all the work that has gone into the ESL project. It is something that Euphoris has long needed. Larry Miller