1. Re: Math Shortcuts
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Jul 07, 1998
- 437 views
On Sat, 4 Jul 1998, Rob Craig wrote: > Intel also has a machine instruction for *rounding* a f.p. > number to the nearest integer. Unfortunately it can't be used > directly for floor(), which always rounds *down*. I discovered the following while trying to code a ceiling routine: function ceiling(object x) return -floor(-x) end function This suggests that the floor function could be defined the same way: -- I'd do this in machine code, but I'm not into Intel op-codes. function floor(object x) return -ceiling(-x) end function Although, I guess this is how you've already done it in the interpreter... :) -- Carl R White E-mail...: cyrek- at -bigfoot.com / Remove the hyphens before Finger...: crwhite- at -dcsun1.comp.brad.ac.uk \ mailing or fingering... Url......: http://www.bigfoot.com/~cyrek/