Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating very large numbers
Message
De
09/09/2009 12:12:30
 
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:
01423294
Vues:
55
>>>>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.
>
>
>Not me :-)
>
>CLEAR
>? GetReminder((22919090710007290*100),  97)
>? GetReminder((22919090710007291*100),  97)
>? GetReminder((22919090710007299*100),  97)
>
>FUNCTION GetReminder(lnNumber, lnDividor)
>
>    LOCAL lcString, lcOstatak, lcOneSymb, lnFor
>    lcString = ALLTRIM(STR(lnNumber,100))
>    ? lcString, lnNumber, [HA ALL Strings and numbers are equal]
>    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
>
check the GetReminder lnNumber parameters, the external are equal to internal ?
22919090710007299*100 is 2291909071000729000 ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform