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

Floats have a totally different algebra than the reals, though.



Only in the strictly mathematical sense. To a first approximation, floating-point numbers behave like real numbers, and that's good enough for many use-cases (not all, though).

Similarly, fixed-width integers have a totally different algebra than true integers, and yet they're immensely useful.


fixed-width integers have exactly the same semantics as true integers bar overflow, which is a very easy to understand concept.

Floating-point numbers behave like a physicist would do calculations rounding at every step, but doing everything in binary. Or hexadecimal if you prefer, it's equivalent, but still difficult to get your head around to. Then there additionally is + and - 0 and + and - infinity, and several settings for how rounding is done exactly.


"To a first approximation, floating-point numbers behave like real numbers"

This is incorrect. To count as an approximation, there have to be some accuracy bounds. This is impossible to define, as the reals don't have the same cardinality as any floating point number system.

Now, for many interesting and useful real-valued functions, a float-valued function can be defined that is an approximation. But there is no general way to map a function defined on the reals to a function defined on the floats with a known accuracy.


Yeah, but closer to the reals than fixed point or integers. That’s kind of the point of the standard.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: