Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by dnautics on Saturday July 01, 2017 @01:19PM
(#14677934)
here is the spec we drafted a few months ago on exactly what you suggest.
https://github.com/interplanetary-robot/SigmoidNumbers/blob/...
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by IshKebab on Saturday July 01, 2017 @02:43PM
(#14678340)
Doesn't that proposal remove the infinities altogether?
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by dnautics on Sunday July 02, 2017 @02:53AM
(#14681241)
Yep!
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by IshKebab on Sunday July 02, 2017 @05:16AM
(#14681638)
So... not exactly what I suggested then?
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by dnautics on Sunday July 02, 2017 @05:58AM
(#14681774)
oh whoops, reading comprehension fail! Yeah that is an interesting idea that crossed my mind! I'm a little bit hesitant to do that because 1) infinities are not really that important to have, and 2) if we have them we want them to be exact values in the Valid representation, which any value ending in a binary 1 would not be.
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by dnautics on Saturday July 01, 2017 @10:48AM
(#14677331)
Great observation! That's a compuational mode we are discussing. It's actually trivial to implement.
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by cesarb on Saturday July 01, 2017 @01:27PM
(#14677985)
Another option could be to borrow a trick from floating point, and have a separate status register with bits that represent the kinds of errors encountered. Before a many-step calculation, software could clear these bits, and if any of them is set after the calculation, there was an error somewhere. Of course, since you don't have a NaN, you have to specify the bit pattern which will be returned by each kind of failing operation (like RISC-V does with integer divide by zero).
That doesn't help if the result could be partially valid, but if a "square root of minus one" or similar anywhere in the calculation means the result is invalid (and would be a NaN under floating point), sticky error bits in a status register could be sufficient.
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by dnautics on Saturday July 01, 2017 @01:40PM
(#14678036)
question: How do you access this status register using standard C? (because if you can't, basically no one will use it)
Re:Beating Floating Point at Its Own Game: Posit Arithmetic ...
by cesarb on Saturday July 01, 2017 @02:08PM
(#14678162)
You use feclearexcept() and fetestexcept() from fenv.h: https://linux.die.net/man/3/fenv
Or is that exception hard to implement?