Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rounding problem?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00348122
Message ID:
00348129
Vues:
26
Hi Janet,

Check this:
? round( 35*943*.00100,2)
? ROUND(0.35000000 * 943.0 *.100 ,2) 
Amazing :))))





>This is strange, but that I had as a quick test:
>
>? .35000000 * 943.0 *.100
>? ROUND(.35000000 * 943.0 *.100 ,2)
>? ROUND((.35000000 * 943.0 *.100) ,2)
>? .35000000 * 943.0 *.100
>? ROUND(.35000000 * 943.0 *.100 ,2)
>? ROUND(33.005000000000,2)
>lnNumber= .35000000 * 943.0 *.100
>? ROUND(lnNumber,2)
>lnNumber= .35000000 * 943.0 *.100
>? lnNumber
>? ROUND(lnNumber,2)
>=messagebox(str(lnNumber,30))
>=messagebox(str(lnNumber,30,15))
>=messagebox(str(lnNumber,30,10))
>=messagebox(str(lnNumber,30,20)) && gives an error
>=messagebox(str(lnNumber,40,20)) && gives an error
>=messagebox(str(lnNumber,40,18))
>? round(33.005,2)
>? round(lnNumber,2)
>? lnNumber==33.005
>? (lnNumber==33.005)
>? (lnNumber==33.00500000)
>? lnNumber
>
>
>It seems like lnNumber<>33.005 for some reason... VFP bug?????
>
>
>>When the following numbers are multiplied then rounded to two decimals the result is 33.00 instead of the expected 33.01.
>>
>> .35000000 * 943.0 *.100 = 33.005000000000
>> ROUND(.35000000 * 943.0 *.100 ,2) = 33.00
>>
>> ROUND(33.005000000000,2) = 33.01
>>
>>The numbers are straight from the command window - not from a table. Is this normal rounding behavior that I don't know about?
>>
>>Thanks for any info!
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform