Beating Floating Point at Its Own Game: Posit Arithmetic [pdf] (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
Replies (2)
You do pretty much always have to convert to an intermediate representation of "mantissa + exponent". That is how IEEE754 impls work also. It is a bit more complex than IEEE to do so, because of the variable-length field, but surprisingly not too much so (count-leading-0 plus a couple of shifts and xors do the trick!) Less than 2ns on my machine :)
Replies (1)
Replies (1)
Replies (1)
Slide-rules are handy because they convert multiplication into addition. Or technically that's what logarithms do, and slide-rules are a physical implementation of logarithms.
Recall the classic identity:
log(x * y) = log(x) + log(y)
Slide-rules have multiple rulers, and some are marked in log scale, which lets you multiply totally mechanically! By aligning the markings, you effectively add two lengths, which (when read back on the log tick marks) becomes multiplication.
If you perform the same algebra transform as above, you see that addition becomes (oddly, but more intuitive the more you think about it) the Softmax function.
https://en.wikipedia.org/wiki/Softmax_function
This is my first time seeing Posits, but (having had similar ideas loosely inspired by the Doom bit-hacks) I just assumed this was one of the main sales pitches for Posits!
https://github.com/interplanetary-robot/mullinengine/blob/ma...
and multiply:
https://github.com/interplanetary-robot/mullinengine/blob/ma...
Here is an example generated verilog files:
https://github.com/interplanetary-robot/mullinengine/blob/ma...
You may find the handcrafted "circ" files more useful.
https://github.com/interplanetary-robot/mullinengine/blob/ma...
https://github.com/interplanetary-robot/mullinengine/blob/ma...
This was the julia library I wrote to be able to output verilog from julia. In the case of the posit math, it's verified by compiling with verlator, and doing a comprehensive (256 x 256 8-bit) scan comparing the emitted C-abi .so file, the wire values from verilog.jl, soft-values from the SigmoidNumbers package, the "true" value.
https://github.com/interplanetary-robot/Verilog.jl