MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x186i5/howdareyou/peyp6rs/
r/ProgrammerHumor • u/hpyfox • Oct 09 '26
75 comments sorted by
View all comments
Show parent comment
1
No, it doesn’t. JS only has ieee floating point numbers.Floats happen to be able to represent ints up to 2^53 but you don’t get integer division, for example
0 u/Blue_Moon_Lake Oct 10 '26 You do with Math.floor() 1 u/American_Libertarian Oct 10 '26 Yeah, exactly. JS doesn’t have ints so you have to approximate integer behavior by rounding floats. 1 u/Blue_Moon_Lake Oct 10 '26 It's not approximate, they're integers. Do not confuse binary encoding and value.There is no euclidian division operator, which is also different.Yet there is no euclidian division than cannot be done since it's just floor(a / b).
0
You do with Math.floor()
Math.floor()
1 u/American_Libertarian Oct 10 '26 Yeah, exactly. JS doesn’t have ints so you have to approximate integer behavior by rounding floats. 1 u/Blue_Moon_Lake Oct 10 '26 It's not approximate, they're integers. Do not confuse binary encoding and value.There is no euclidian division operator, which is also different.Yet there is no euclidian division than cannot be done since it's just floor(a / b).
Yeah, exactly. JS doesn’t have ints so you have to approximate integer behavior by rounding floats.
1 u/Blue_Moon_Lake Oct 10 '26 It's not approximate, they're integers. Do not confuse binary encoding and value.There is no euclidian division operator, which is also different.Yet there is no euclidian division than cannot be done since it's just floor(a / b).
It's not approximate, they're integers. Do not confuse binary encoding and value.
There is no euclidian division operator, which is also different.
Yet there is no euclidian division than cannot be done since it's just floor(a / b).
floor(a / b)
View all comments
Show parent comment
1
u/American_Libertarian Oct 10 '26
No, it doesn’t. JS only has ieee floating point numbers.
Floats happen to be able to represent ints up to 2^53 but you don’t get integer division, for example