Hacker News new | past | comments | ask | show | jobs | submit login

Maybe OP reacted because a float only looks like it is a way to store decimal numbers, when it's only an approximation of decimal numbers. If you really need decimal numbers you need something like mpmath¹.

As a shorthand to explain what a float is to someone, "a decimal number" is an OK start though.

But sometimes that approximation breaks down even for simple examples, i.e. 0.1 cannot be represented as a float. This can be quite unexpected if your mental model is that "floats are decimal numbers with a certain precision".

1: https://mpmath.org/




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: