Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Round() problem
Message
From
05/06/2008 12:42:39
 
 
To
05/06/2008 03:39:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01321604
Message ID:
01321901
Views:
17
Hi Nuno,

I don't consider this issue as a bug, you're just playing with 'the last bit'. Your possible solution is wrong, try:
86.179375
86.181875
86.190625
86.201875
etc
Because you make calculus with 6 decimals and you're so keen to be precise I would try something like:
?ROUND(ROUND(mpay*1000000,0),-4)/1000000
Regards,
Sergey

>The problem happen because the value to be rounded was a calculated variable, and VFP has a bug since vfp3 I gess.
>Example:
>
>
>mrate = 86.173125
>mhours = 24.0000
>mpay = mhours * mrate
>? mpay
>? ROUND(mpay, 2)
>
>
>One possible solution:
>
>
>mrate = 86.173125
>mhours = 24.0000
>mpay = mhours * mrate
>? mpay
>? ROUND(val(transf(mpay, "99999.99999")), 2)
>
>
>
>Thank's all for help
>NPedro
Previous
Reply
Map
View

Click here to load this message in the networking platform