News for hackers. Stuff that matters.
Re:High Performance Correctly Rounded Math Libraries for 32-... by ant6n on Thursday August 26, 2021 @07:46PM (#28322496)
At that point, it would seem more sensible to just define a list of values that are represented by each possible 8-bit number, and use LUTs for operations. Why even torture this exponent and mantissa concept down to 8 bits when one can have a domain specific set of representable numbers that have exactly the properties that are needed.
Re:High Performance Correctly Rounded Math Libraries for 32-... by GeorgeTirebiter on Friday August 27, 2021 @03:28PM (#28332000)
I did exactly this - 8-bit floats. The application needed fairly accurate representations around 0; but didn't wildly swing. It was for an IMU that had to have the internal representation converted to 'regular units'. Ultimately, Q.15 won; but it was interesting. In fact, I encourage you to try it with e.g. 4 mantissa 4 exponent, and enumerate all values.
Re:High Performance Correctly Rounded Math Libraries for 32-... by ant6n on Friday August 27, 2021 @05:06PM (#28332972)
For a game boy (original) project I wanted to represent distance values in range 0.3..32 with a u8, but with higher precision for closer values, but approximately linear relationship for distances that are close to one another, with precision of ~0.05 around d=0 and <0.30 around d=32.

I ended up creating a set of values that follows different mathematical functions in different segments (exponential, linear, quadratic). As a float this wouldn´t have worked, because the precision halves for every new exponent, so the distances between adjacent values are not approximately linear.