Well Rounded: Visualizing Floating Point Representations

Team Members: Neil Ryan, Katie Lim, Gus Smith, Dan Petrisko

Links

Background

Numerical datatypes—how real numbers are represented in computer hardware—are absolutely foundational to the design of every computer in the world. It is surprising, then, that these datatypes have been largely unchanged for decades! For the most part, all computers rely on the IEEE 754 floating point specification, which gives us the float and double types that computer programmers may be familiar with. Today, though, these datatypes are finally coming under the microscope, as computer architects seek to squeeze every ounce of performance out of their hardware.

This visualization seeks to educate the user on numerical datatypes. Specifically, we present the posit, an interesting new numerical datatype.

Posits are a new numerical datatype developed to compete with the standard IEEE 754 format. Posits add a number of very interesting features over IEEE floating point, but the most interesting at a high level are (1) the addition of the es parameter, and (2) the addition of the regime bitfield.

IEEE floating point numbers have only one parameter, n, which describes their length (generally 32 or 64). In addition to n, posits have another parameter es. es determines two things:

The regime bitfield is a varying-length, unary-encoded field which comes just after the posit's sign field. The field is encoded as a number of 0s ending with a 1, or a number of 1s ending with a 0: 001 or 1110, for example. The number of 1s or 0s translates to the sign and value of k, a number used to calculate the value of the posit.

The final posit is calculated as sign * useed^k * 2^exponent * 1.fraction.

In this project, we present an interactive version of the visualization shown on page 2 of John Gustafson's original posit paper and page 16 of Peter Lindstrom's CoNGA 2019 slides. This visualization shows the posits laid out on the projectively-extended real number line, which is actually a circle, rather than a line. This is the number line we're used to, but with both infinities being represented by the same point. This makes sense for posits, as posits only have one representation for infinity. The process of filling out the values on this circle is often called posit bisection, hence the original title of our A3 project: Posit Bisection.

Interaction

To illustrate the effect that the n and es parameters have on the posit representation, we provide sliders that allow the user to change these values. This affects the visualization in a variety of ways. The two main ways are that changing n affects the number of dots on the circle and changing es affects the coloring of the bitstrings if there are bits available for the exponent field.

The bitstrings in the posit representation are colored to differentiate between fields in the posit representation. Details on demand about how the posit value is calculated is available via tooltip by mousing over the associated dot. The top dropdown menu in the center of the circle also offers the ability to see fractional values as labels instead of bitstrings.

To focus on certain regions of the circle, we provide brushing capabilities. The selected region is shown on the numberline in the middle of the circle. The numberline also shows rounding tie-points between posits with small arrowheads to show in which direction the tie is broken.

To better illustrate the distribution of numbers represented in the posit, the lower dropdown menu in the middle of the circle provides three options that control how dots are spaced along the circle: ordinal, linear, and logarithmic. These viewing modes can be used in conjuction with the n and es sliders to determine how these parameters affect the distribution of the posits.

We also provide a histogram representation that represents the number of values clustered in that region of the circle arc to better illustrate distribution of values. Tooltips avaiable by mousing over a histogram bar also provide details about the total number of values in that region.