logoalt Hacker News

andrepd • today at 9:30 AM • 1 reply • view on HN

If you mean a software implementation, I would daresay my impl is actually pretty readable :) https://github.com/andrepd/posit-rust/blob/main/src/posit/op.... It's also the fastest I'm aware of (at least back when I was working on it).

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

schiffern • today at 9:43 AM

It's effectively a "slide rule" numerical system so (to avoid intermediate representations) multiplication become addition and addition becomes softmax, right?

➕ show 1 reply