4 ms·
to be robust you need to deal with overflow and underflow and also pesky differences in domain. overflow breaks (x + y) / 2. where x and y are large underflow
by bnolsen 10y ago
to be robust you need to deal with overflow and underflow and also pesky differences in domain.
overflow breaks (x + y) / 2. where x and y are large
underflow breaks (x / 2.) + (y / 2.) where x and y are small.
and of course the problem where x is outside the exponent of y. But one of these values gets treated as though it were insignificant and effectively 0.
- Scea91 10y agoI think that it is necessary to make a compromise between absolute robustness and readability, maintainability etc. I hope that the input to the program is sensible enough that floating point overflow won't be an issue, since there are more complicated formulas in the program than this simple one.