Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating very large numbers
Message
De
09/09/2009 11:58:24
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01423218
Message ID:
01423288
Vues:
65
>>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
>
>
>
>? GetReminder((22919090710007290*100),  97)
>
>FUNCTION GetReminder(lnNumber, lnDividor)
>
>    LOCAL lcString, lcOstatak, lcOneSymb, lnFor
>    lcString = TRANSFORM(lnNumber)
>    m.lcOstatak = []
>    DO WHILE NOT EMPTY(m.lcString)
>       m.lcOneSymb = VAL(m.lcOstatak + LEFT(m.lcString,1))
>       m.lnFor     = INT(m.lcOneSymb/lnDividor)
>       m.lcOstatak = TRANSFORM(INT(m.lcOneSymb - m.lnFor*lnDividor))
>       m.lcString  = SUBSTR(m.lcString,2)
>    ENDDO
>RETURN m.lcOstatak
>
>That is the function I used for checking for correct IBAN value :-)

mmmmhhh!
? GetReminder((22919090710007290*100),  97)
? GetReminder((22919090710007291*100),  97)
? GetReminder((22919090710007299*100),  97)
you cannot play with long numbers.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform