Results 1 to 2 of 2
Thread: Updating a flot is strange
Jan 8, 2010, 01:14 #1
- Join Date
- Jan 2009
- 0 Post(s)
- 0 Thread(s)
Updating a flot is strange
I noticed a strange problem, following is the table structure:
currencies_id int(11) NO PRI NULL auto_increment
title varchar(32) NO
code char(3) NO
symbol_left varchar(24) YES NULL
symbol_right varchar(24) YES NULL
decimal_point char(1) YES NULL
thousands_point char(1) YES NULL
decimal_places char(1) YES NULL
value float(13,8) YES NULL
last_updated datetime YES NULL
using PHPMyAdmin I executed the following update statement:
update currencies set title = 'US Dollar', code = 'USD', symbol_left = '$', symbol_right = '', decimal_point = '.', thousands_point = ',', decimal_places = '2', value = '48.3' where currencies_id = '1'
The value filed should store 48.30 after the successful execution but I noticed it is: 48.29999924.
For any floating value it is doing this, I tried it on my local installation as well but the same problem. Is it a MySQL Bug?
Am I doing something stupid?
Jan 8, 2010, 03:01 #2
- Join Date
- Jan 2004
- Uppsala, sverige
- 2 Post(s)
- 1 Thread(s)
Use decimal instead of float. Float is an aproximate datatype.