Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Type inconsistency in Arithmetic Functions

From: santilli:gabriele:gma:il at: 12-Aug-2007 10:33

2007/8/11, Peter Wood <>:
> As the average machine has a much faster processor now than when Rebol > 2 was conceived and Rebol 3 looks to be even faster than Rebol 2, do > you think it would be worth considering returning an integer! from > power or ** in Rebol 3 ?
It's not a matter of how fast the machines are. It's a matter of how inefficient it would be. When it comes to division, you can do integer division, which is usually one op for the processor, then check remainder and if non-zero do the slower floating point division (with all the conversions involved). But when it comes to power, there is no integer power. So you'd have to do the conversions, obtain floating point result, then check if it has no fractional part (which involves rounding, unless you want to return integer sometimes, decimal some other times, in a completely unpredictable way), and if not convert back to int. Since in practice it makes absolutely no difference, this would be a complete waste of time. Regards, Gabriele.