PDA

View Full Version : What's up with float?


jordipa
01-30-02, 10:53
When I show the value of a float import with Enterprise manager, it returns:(EX: 60.1012), but if i try to show it with Query analyzer, it's diferent!!!! (Ex: 60.1012000000000002)

But I don't know, why???

I'm sure this affects my ASP aplication.(Hello Jordi from Barcelona).

Apel
04-02-02, 06:27
I don't know about the progs you are using specifically but I assume they just display the value in different precision. Maybe there's an option in Enterprise Manager to control display precsion of float values (maybe someone with more insight can guide you the way).

In general you should be aware of rounding when handling float values. Even simple calculations can cause rounding errors and might accumulate over time. If you need to be sure your data is and stays the same precision use the numeric data type instead of float.

rnealejr
04-25-02, 17:59
Use numeric or decimal data types - float/real are approximations - that is why you are receiving additional information.