Re: error update
Alexander Keremidarski <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi,
leong wrote:
> I have a field in type of float(20,2),
> the value is 158059.45, i want to update to 158059.46,
> but it can't update.
> and there are some update have the same problem like,
> 158059.01 will become 158059.02
> 158059.04 will become 158059.05
> 158059.07 will become 158059.06
> 158059.10 will become 158059.09
> 158059.13 will become 158059.12
>
> can you help me with this problem?
There is no problem. This is consequence of using floating point arithmetic where
values are never precise. 0.1 for example can be represented as 0.99999999
Conisder using DECIMAL or use some rounding.
Best regards
--
Are you MySQL certified? -> http://www.mysql.com/certification
For technical support contracts, visit https://order.mysql.com/?ref=msal
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Alexander Keremidarski <[email protected]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Sofia, Bulgaria
<___/ www.mysql.com
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/[email protected]