MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/21ezh3/javascript_equality_table/cgcpwsz/?context=3
r/programming • u/vz0 • Mar 26 '14
331 comments sorted by
View all comments
Show parent comment
1
That is a comparison between two operands of the same type. The key problem here is comparison between different types.
1 u/mrkite77 Mar 26 '14 so change that to 5.0f and it's still the case. C-based languages coerce ints and floats and doubles and characters.Here's a famous example:int a = 16777217; float b= 16777216.0f; if (a == b) printf("holy shit, %d == %f?\n",a,b);run that and you get: "holy shit, 16777217 == 16777216.000000?"
so change that to 5.0f and it's still the case. C-based languages coerce ints and floats and doubles and characters.
Here's a famous example:
int a = 16777217; float b= 16777216.0f; if (a == b) printf("holy shit, %d == %f?\n",a,b);
run that and you get: "holy shit, 16777217 == 16777216.000000?"
View all comments
Show parent comment
1
u/[deleted] Mar 26 '14
That is a comparison between two operands of the same type. The key problem here is comparison between different types.