Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding large numbers
Message
From
13/09/2013 05:19:44
 
 
To
13/09/2013 04:01:54
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01582980
Message ID:
01583121
Views:
51
>>I realized the calculation must be done using character strings instead of numbers. I found the code on Tek-Tips, which gives the correct result:
>
>Looks like something I did back in the 80s (when I was trying to calculate e to 600 digits). It's OK as a method, except the speed. My method was to chop it into smaller pieces and stuff them into an array, 6 digits at a time, although with IEEE number I can probably even do multiplication with 7 without overflow. So I'd do an operation on a pair of elements of two arrays and stuff into the corresponding element of the third array, take the carry to the next element and so on. The end result was converted back into a string. Used to be reasonably fast even on a Spectrum with a 1.7MHz z80.

Done that too, years ago. A class with an auto expanding array. And yes, you can safely keep 7 digits per array element (multiplication yields 14 digits)
8 digits is not safe.

Even started trig functions using CORDIC ( http://en.wikipedia.org/wiki/CORDIC#Software_implementation )

But, never finished it
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform