range error
Dar Scott
dsc at swcp.com
Fri Apr 9 01:55:21 EDT 2004
On Thursday, April 8, 2004, at 09:56 PM, Stephen Messimer wrote:
> Type Operators *: range error (overflow)
> Object Bed Adequacy
> Line else return theNumber * factorial(theNumber -1)
> Hint factorial
>
> Is there a work around for this?
>
> OSX 10.2.8, Rev 2.1.2, 512 MB of RAM
I have 10.2.8, too, and for many calculations I get 00000Inf.
The "double" floating point numbers used by Revolution use about 11
bits for the exponent. A few special codes are used, but that is
approximately the range.
Try 2^1000 and 2^2000 in the message box.
Try length(2^1000). Or 169^169.
I'm making a list of what kinds of libraries I might build soon and on
my list are several variations of enhanced numbers and associated
arithmetic. I am interested in what ranges folks would find
interesting or useful. I might find something else more fun or
lucrative, though.
As for your workaround... You might look at your math. If you are
dividing a factorial by a factorial, you might want to change your
function to multiply the number n to m instead. You might convert your
math to work with the logs of your values.
If you really need extended math you might build your numbers out of
multiple numbers.
Dar Scott
More information about the use-livecode
mailing list