Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating very large numbers
Message
From
09/09/2009 09:05:22
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
09/09/2009 04:19:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01423218
Message ID:
01423243
Views:
119
This message has been marked as the solution to the initial question of the thread.
>Dear All
>
>Is there any way to make precise calculation without number being rounded
>
>? 22919090710007290*100/97
>
>Returns rounded number. I need actual remainder.
>Mod(22919090710007290*100,97) returns 0
>
>What are the options.
>
>TIA
>Sergio

Visual FoxPro's built-in calculations use a fixed number of significant digits - about 15 or 16. Even when you are only approaching that limit, there may be rounding errors, due to the conversion between decimal and binary - since the computer internally does calculations in binary..

You can do calculations on strings of numbers, one digit at a time, using the well-known algorithms of addition, subtraction, etc., but the result would be much slower. In any case, it is thus possible to have arbitrary precision.

See my download #10044, which does all that.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform