Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to fix rounding bug
Message
From
24/10/2007 16:05:22
 
 
To
24/10/2007 14:17:17
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01258001
Message ID:
01263330
Views:
24
Will it always work?
Why not?

I have created RROUND.PRG like this:
Lparameters m.nNumber , m.nPrecision
Return Iif( m.nNumber < 0 , ;
-1 * Round(Int(Val(Transform(-1* m.nNumber*10^m.nPrecision+.5)))/10^m.nPrecision, m.nPrecision), ;
Round(Int(Val(Transform(m.nNumber*10^m.nPrecision+.5)))/10^m.nPrecision, m.nPrecision) )

All my code uses RROUND instead of ROUND. I have not been able to find any problems with this.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform