this post was submitted on 05 Apr 2025
55 points (98.2% liked)
Programmer Humor
22726 readers
1629 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
More people need to learn to use Rational types. A pretty large majority of the numbers that people care about in real life can easily be represented by a ratio of integers, and they allow math with perfect precision.
Or just BigDecimal or an equivalent if rational types aren't easy to use in your language (e.g if you'd have to literally enter the denominator and numerator).
Someone posted this article a while back that goes into more detail on some alternatives, as well as contains one of the best and most intuitive explanations of floating point that I've ever read.