Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating very large numbers
Message
From
09/09/2009 11:58:24
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01423218
Message ID:
01423288
Views:
64
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform