Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INT()egering a Numeric type, expected value isn't correc
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00383077
Message ID:
00383581
Views:
18
x = 3.999999999999999
z = x * 4
? z        && Prints 16.000000000000000
? int(z)   && Prints 15
In the above it is the ? x that is wrong not the INT(x). x is not 16, but is close to but below 16. INT(x) does exactly what it should do which is to return the integer portion of the value regardless of the decimal portion.

This is a rounding error that is always going to be a problem.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform