Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Modulus 97 on a very large number
Message
De
06/03/2007 11:42:06
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01200962
Message ID:
01201081
Vues:
17
>Hi all,
>
>can someone tell me how I can calculate the modulus 97 on a number with 23 digits ? It seems that the MOD function has a problem with the large number. Is there another option ??

You could use maths... subtract the largest value of 97*10**n that can fit your number... but do it as a string:

- have the original 23-digit number as a string.
- divide it into groups of, say, 6 digits each.
- find the mod(group1,97) of the leftmost group.
- add the digits you got to the second group
- find the mod(mod1*1000000+group2, 97)
- repeat that with 3rd and 4th group.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform