Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add a big number
Message
From
30/07/2012 12:34:58
 
 
To
30/07/2012 12:16:43
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01549526
Message ID:
01549529
Views:
83
>I want to create a group of big number2, such as:
>
>123456789012345678901001
>123456789012345678901002
>123456789012345678901003
>
>
>I did
>
>nstart=123456789012345678901001
>cstart=alltrim(trans(nstart,'999999999999999999999999'))
>
>for i=1 to 10
>nstart=nstart+1
>cstart=cstart+'  '+alltrim(trans(nstart,'999999999999999999999999'))
>next
>
>
>but VFP can only add the first 16 digits
>thus I only get
>
>123456789012345678901001
>123456789012345600000000
>123456789012345600000000
>123456789012345600000000
>123456789012345600000000
>
In VFP9 Help (HELP SYSTEM CAPACITIES): Digits of precision in numeric computations: 16

"Visual FoxPro can handle numbers up to 9007199254740992 (2^53) in exact computations."

Are these large numbers actually for use in numeric calculations, or are they really just identifiers? If the latter you can use strings instead:
lcStub = "123456789012345678901"

FOR lnIx = 1 TO 10 STEP 1
  ?lcStub + PADL( LTRIM( STR( lnIx ) ), 3, "0" )

ENDFOR
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform