WARNING: Some numerical analysis and mathematics will be mentioned in passing. Also the number systems will not be treated like black-boxes. Risk of physical injury, however, is negligible. I like magic tricks. Watching the performer do the show and attempting to catch the “slight-of-hand” that makes the impossible seem possible. It’s fun and makes me believe in magic for a few moments. So I’m going to give a shot at doing some floating point magic tricks. Throughout my performance I’ll use two 32-bit formats: IEEE binary32 (aka singles or float in a number of languages) and posits (with es=2). NARRATOR: For general purpose computations 32-bit is about as small as we can push, otherwise bit size choice doesn’t matter. Gustafson uses es=3 to cover the range of binary32 but suggests that es=2 is a better and it look like that’s the value they’re running with for the specification. The choice doesn’t matter in the slightest for this discussion. Originally this was going to be one big post but I’ve decided to break in in parts. Source code will be provided in a later version (for reasons). There are so many intertwined issues that it’s almost impossible to provide some nice linear presentation. Goldberg’s long thin triangle performance LIVE on stage NARRATOR: Kahan presented this problem in or prior to 1986 and the Goldberg paper (from 1991) was inspired from attended a conference by Kahan. We are going totally compute the area $A$ of a thin triangle using the classic form of Heron’s equation. Life’s way too short to think about computation! \[\begin{align*} s & = \frac{a+b+c}{2} \\ A & = \sqrt{s\left(s-a\right)\left(s-b\right)\left(s-c\right)} \end{align*}\] With a wave of my hand I declare the lengths to be: \[\begin{align*} a & = 7 \\ b & = c= \frac{1}{2}\left(a+3~\text{ulp}\left(a\right)\right) \end{align*}\] and let’s pull out of my magic computationalizing box the exact, the super-mojo-exponent and tapering-precision-just-exactly-where-you-need-it posits and poor ...
First seen: 2025-06-19 15:06
Last seen: 2025-06-20 01:21