Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
inaba46257yIt's a new week alright. That's one of the features of IEEE754 and why using .toFixed is a good idea when using floats
-
You're not a bad programmer. I think you should read a bit about how decimal places work in computers
-
One of our first programming classes in Python, our teacher had a trick question about this.. Spent about an hour trying to figure out why the hell my code wasn't working.. If it wasn't for that assignment, I probably wouldn't know about this either. :)
-
A brotip is that you should not be using == for comparison. Instead, you should take the absolute value of their difference, and compare if it's smaller than a threshold value. This depends on the task and the required precision.
-
bahua129047yWhen working with floating point numbers, make sure to sprintf before evaluating them.
-
I suggest you look into Number.epsilon in order to enforce equality on these types of comparison
-
@teganburns was it a joke? Because jokes are supposed to be funny. Unless Im missing something this isnt funny in any way
I swear I didn't know that. Am I a bad programmer? Should I quit writing code?
rant