Create RUST posit arithmetic library based on 21 February 2017 Posit Arithmetic by John L. Gustafson - Beating Floating Point at its Own Game


#1

Create RUST posit arithmetic library
Based on 21 February 2017 Posit Arithmetic by John L. Gustafson -

Please advise how to do this in the Rust way. Thanks.

Is it possible to extent this RUST library?
RAMP - Rust Arithmetic in Multiple Precision

posit arithmetic background -
Beating Floating Point at its Own Game
Stanford Seminar: Beyond Floating Point: Next Generation Computer Arithmetic

There is some work here -
Sigmoid Numbers posit for Julia
Based on the posit Sigmoid Numbers Invented by John Gustafson

And here -
Beyond Floating Point - Posit C++ implementation


#2

This is a recent version of unum approach. It has many revisions, with the first public version (so-called unum 1.0) has been criticized a lot (Kahan is the primary architect behind IEEE 754 format)—my tentative conclusion was that unum 1.0 (besides from its own flaws) requires lots of changes to the programming model so it cannot fly at all. Unum 2.0 (or whatever) is presumbly somewhat different but I haven’t looked at. But just in case, I think an implementation with a missing add function is not usable at all.


#3

This sounded interesting so I have started a posit implementation here. It
supports posits of any size less or equal than 32 bits with any value of ES. It
supports the four basic arithmetic operations and conversions from/to f64.

I was looking for efficient float math for a FPU-less (Cortex-M) processor but
my posit implementation is 2-3x slower (I made zero effort towards optimizing it
though) than emulated ieee754 floats :-/ so I’m going to stick to fixed point
arithmetic for now even though is suffers from overflows / underflows and I have
to be careful about the range of operations.

Unscientific micro-benchmark below

CPU: Cortex-M3
Numbers are clock cycles

  • 1.1 +/* 1.2
| Format        | +   | *   |
|-------------- |-----|-----|
| P32E6 (posit) | 187 | 225 |
| Q16.16 (FPA)  | 23  | 29  |
| f32           | 107 | 78  |

FPA = fixed point arithmetic
P32E6 = 32-bit posit with ES = 6
Q16.16 = fixed point number, 16-bit for the integer part, 16-bit for the fractional part
f32 is software emulated (compiler-rt)

  • 0.9 +/* 100.2
| Format        | +   | *   |
|-------------- |-----|-----|
| P32E6 (posit) | 208 | 233 |
| Q16.16 (FPA)  | 23  | 29  |
| f32           | 104 | 78  |