MYSQL do wrong math with strings [duplicate]
This question already has an answer here:
Is floating point math broken?
28 answers
Simple sql code gives strange result:
select '0.29'*100;
Result: 28.999999999999996
Another one:
select '0.28'*100;
Result: 28.000000000000004
What's going on? Is it a bug?
I couldn't find any other number that behaves like that.
mysql string math
marked as duplicate by Amadan, High Performance Mark, Madhur Bhaiya, Giorgos Myrianthous, meowgoesthedog Nov 21 '18 at 8:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Is floating point math broken?
28 answers
Simple sql code gives strange result:
select '0.29'*100;
Result: 28.999999999999996
Another one:
select '0.28'*100;
Result: 28.000000000000004
What's going on? Is it a bug?
I couldn't find any other number that behaves like that.
mysql string math
marked as duplicate by Amadan, High Performance Mark, Madhur Bhaiya, Giorgos Myrianthous, meowgoesthedog Nov 21 '18 at 8:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Is floating point math broken?
28 answers
Simple sql code gives strange result:
select '0.29'*100;
Result: 28.999999999999996
Another one:
select '0.28'*100;
Result: 28.000000000000004
What's going on? Is it a bug?
I couldn't find any other number that behaves like that.
mysql string math
This question already has an answer here:
Is floating point math broken?
28 answers
Simple sql code gives strange result:
select '0.29'*100;
Result: 28.999999999999996
Another one:
select '0.28'*100;
Result: 28.000000000000004
What's going on? Is it a bug?
I couldn't find any other number that behaves like that.
This question already has an answer here:
Is floating point math broken?
28 answers
mysql string math
mysql string math
edited Nov 21 '18 at 8:06
Paulius Ščerbinskas
asked Nov 21 '18 at 8:05
Paulius ŠčerbinskasPaulius Ščerbinskas
41
41
marked as duplicate by Amadan, High Performance Mark, Madhur Bhaiya, Giorgos Myrianthous, meowgoesthedog Nov 21 '18 at 8:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Amadan, High Performance Mark, Madhur Bhaiya, Giorgos Myrianthous, meowgoesthedog Nov 21 '18 at 8:54
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Double is 32-bit, and when you output it's an int, it's 16 bit, and of course there's a loss of precision
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Double is 32-bit, and when you output it's an int, it's 16 bit, and of course there's a loss of precision
add a comment |
Double is 32-bit, and when you output it's an int, it's 16 bit, and of course there's a loss of precision
add a comment |
Double is 32-bit, and when you output it's an int, it's 16 bit, and of course there's a loss of precision
Double is 32-bit, and when you output it's an int, it's 16 bit, and of course there's a loss of precision
answered Nov 21 '18 at 8:28
LoGanLoGan
111
111
add a comment |
add a comment |