The following tool lets you inspect the computational flow of a floating point expression, seeing where rounding occurs, when exceptions are triggered

graphitemaster / fpinspect

submited by
Style Pass
2021-07-24 05:30:05

The following tool lets you inspect the computational flow of a floating point expression, seeing where rounding occurs, when exceptions are triggered, when precision may be lost, when special values propagate, when error accumulates, and other floating point headaches.

As you can see, the expression sqrt(45.0*e+phi)/pi produces a lot of output, each empty-line-separated region is a subexpression which triggered an exception, in this case because 45 * e is an inexact value, the inexact exception is presented first. Here you can see that such an expression involved 1 operations, total and in this case the operation is just a MUL. We can also see that the resulting expression, because it's inexact, incurred one rounding.

Following down the exception list, we can see that the exception propagated to phi in a MUL (which is also an inexact value), and continued, with each new inexact subexpression resulting in several roundings. Since kernels like sqrt might themselves use operations like add, we also see the final group of exceptions contains an additional ADD in it's trace.

The final result of the expression is given in ans: and below that you will find the accumulative error err: of evaluating that expression, in this case this function is exact to five mantissa digits of precision, out of a total of seven, which means this expression has ~0.71 ULP of error.

Leave a Comment
Related Posts