5 ms·
The thing about floating point numbers is that while they're not associative... they are approximately associative (mod inf and nan). In other words (ab)c = a(
by bodhiandphysics 4y ago
The thing about floating point numbers is that while they're not associative... they are approximately associative (mod inf and nan). In other words (ab)c = a(bc) + e where e is is a number much smaller than max(a,b,c). This means that we can measure quite easily how bad an operation is in floating points, using what's called the condition number, and there are many many good ways of either estimating or bounding the condition number. So floating point numbers are easy to analyze, though they require a bit more machinery than most programmers get in intro to computer science.
Really floats are the right way to do calculations involving reals on the computer. Of course, if you're not actually using reals, you shouldn't use them!
- mjhay 4y agoYeah the condition number helps in simple cases (or when solving single linear systems), but things rapidly spiral once you start getting into solving stiff ODEs, etc - to the point that only numerical specialists can judge it. I feel like there ought to be ways of dealing with these issues in a more fine-grained manner with better guardrails - something like a numeric-aware typesystem or automatic algorithmic scheme generator. Like I said though, maybe in 100 years.
- bodhiandphysics 4y agostiffness has nothing to do with fp numbers... stiff equations are just as hard to solve using arbitrary precision bigints since the issue is the limits of approximations of the integral.
- mjhay 4y agoThat's getting back to my point though - the integral is over measurable sets of reals, and we are approximating that with finite-difference floats. This is a complex problem with many guises.