range error - or "How to take the factorial of a huge

Stephen Messimer steve at messimercomputing.com
Fri Apr 9 12:37:03 EDT 2004


Message: 4
Date: Thu, 8 Apr 2004 23:59:06 -0600
From: Dar Scott <dsc at swcp.com>
Subject: Re: range error - or "How to take the factorial of a huge
	number"
To: How to use Revolution <use-revolution at lists.runrev.com>
Message-ID: <02A697E9-89EB-11D8-8E0D-000A9567A3E6 at swcp.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Thursday, April 8, 2004, at 11:15 PM, Jim Witte wrote:

>> I don't know how you get around this one though, short of using a
>> CPS'd function as an XCMD.
>
> I have used collections of numbers to represent numbers.

Huh? You guys are striking directly at the heart of my math disability! 
  So are you suggesting that if I want to raise a number to the power of 
200 that I divide the exponent by 2 and then use the two smaller 
resulting exponents to perform the calculations and then somehow sum 
the results?  Duh.  I'm sure it is  becoming amusingly obvious to many 
on this list that there is a really good reason I didn't become an 
engineer.  :-).

>
>> There *might* be a way to split the number up into smaller units, and
>> then combine them at the end in some way, but I have no idea how - I'm
>> thinking of the "Saturn" BCD architecture used by some calculators,
>> and the recursive fast-multiply algorithm for multiplying truly huge
>> numbers (hundreds or thousands of digits each..)
>
> Hmmm.  It is not clear to me whether Stephen needs more digits or just
> a greater range, that is, a greater exponent in is scientific notation.
>
> Dar Scott

I think you are absolutely right Dar.

range is certainly the immediate problem for me. When I attempt this

put format("%1.2e",(2027^93)) into msg I get "3.45e+307" :-) ,  great.

if I try

put format("%1.2e",(2027^94)) into msg I get INF :-( ,  bummer.

I would like the ability to raise a number to up to 250th power.

I could probably get by with 93 if I had to although it will place some 
limitations on the application I am building. Oh well ...

Thanks for the insights in any case.

Regards

Steve


Stephen R. Messimer, PA
208 1st Ave. South	
Escanaba, MI 49829
http://www.messimercomputing.com
--
Build Computer-Based Training modules FAST with preceptorTools™ -- 
version 1.0.5 available Now!



More information about the use-livecode mailing list