Earlier quoted context omitted.
Posits seem impressive. My only concern is the lack of NaNs seems like a bug rather than a feature. It's true that some programmers do the silliest things when faced with NaNs. But the fact is they are useful. You often want to do calculations over big matrices, where some elements simply don't have a mathematically defined answer (usually because of div0s but also because input data might have holes). It would be a…
I think I would probably choose to have one NaN rather than +/-Infinity. Infinity itself is not a number -- it's just a special NaN.
16-bit math look-up tables – the unexpected power of scaled-integer math
31–40 of 54 posts
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#32Earlier quoted context omitted.
I think I would probably choose to have one NaN rather than +/-Infinity. Infinity itself is not a number -- it's just a special NaN.
Infinity is certainly a “number”; https://en.wikipedia.org/wiki/Projectively_extended_real_lin... https://en.wikipedia.org/wiki/Riemann_sphere
The projectively extended real line doesn't support adding infinity to itself, which is what the grandparent to your comment was talking about. The problem is that the projectively extended real line does not have both a positive and negative infinity.
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#33Earlier quoted context omitted.
>is the lack of NaNs seems like a bug rather than a feature. I think this is a reasonable concern. I'll propose to John that we make there be an optional "mode" where the infinity token is treated as "NaN". In reality, this mode just amounts to "ignore NaN traps", because the way that it's done in my hardware models, it requires almost no extra hardware.
What if we want both NaN and infinity?
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#34For instructional purposes, here is a simple Python implementation that uses only adds and shifts in the inner loop, followed by a single scaled-multiply to finish it up: https://code.activestate.com/recipes/576792-polar-to-rectang...
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#35Earlier quoted context omitted.
Unums are unlikely to gain much usage. Posits[1][2], also by Gustafson, are a more reasonable alternative to IEEE-754 floating point (but will still have a difficult time displacing IEEE-754, if they can at all). [1] http://web.stanford.edu/class/ee380/Abstracts/170201-slides.... [2] https://www.youtube.com/watch?v=aP0Y1uAA-2Y
Posits seem impressive. My only concern is the lack of NaNs seems like a bug rather than a feature. It's true that some programmers do the silliest things when faced with NaNs. But the fact is they are useful. You often want to do calculations over big matrices, where some elements simply don't have a mathematically defined answer (usually because of div0s but also because input data might have holes). It would be a…
I haven't written them up yet, but _valids_ are what you want if you are want software that can gracefully and mathematically handle the results that make floats generate a NaN. Think of the valid computing environment as the numerical debugging environment for posits. It's slower and ultra-careful and rigorous, but once you get your algorithm to the point where it never tries to color outside the lines, then switch to posits and go FAST.
Leaving a NaN in a number system designed for lean speed is a mixing of computing esthetics. Which do you want? Rigorous and careful and mathematical, or good enough, fast, and cheap? You have to make up your mind, because if you _mix_ the two esthetics in one number system, guess what: You get neither. It won't be fast, because it has to check for exceptions all the time, and it won't be mathematical because it keeps replacing correct answers with answers within its vocabulary (that is, it rounds). IEEE floats are a mixture of the two esthetics, and that is their fatal flaw.
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#36Earlier quoted context omitted.
It’s usually possible to re-frame problems to not require trig functions at all. For instance, you can represent rotations as unit magnitude complex numbers, compose them using complex multiplication, and trivially get whatever trig functions you want out. If you need to compress them for I/O, take the stereographic projection (requires 1 division per point for both forward and inverse transform) and then optionally…
Construction of a unit complex number though, given an angle, requires trigonometry. Precomputing this and re-using it is identical to precomputing the sine and cosine of that angle and reusing them instead - the complex number itself doesn't simplify anything here other than storing both the sine and cosine in one variable.
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#37Ah shit, can't believe I missed this, all these years. Jack Crenshaw ie Let's Build a Compiler. Love that guy.
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#38Ah shit, can't believe I missed this, all these years. Jack Crenshaw ie Let's Build a Compiler. Love that guy.
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#39Earlier quoted context omitted.
> However, unless you're using a CPU from the 6502 era, it's probably not worth the trouble for multiplication and division. When we talk PC, fixed point math was popular a few generations longer than the 6502 era. The 6502 had no multiply and division instructions at all, and up to the 80386 there was only integer multiply and division and that was slow as molasses. Before the 80486 fixed point wasn't a matter of sp…
indeed, I was using fixed point maths on PlayStation 1 games in the mid to late 90s. It was often responsible for the gaps you'd see between polygons on many PS1 games.
Re: 16-bit math look-up tables – the unexpected power of scaled-integer math
#40Earlier quoted context omitted.
Unums are unlikely to gain much usage. Posits[1][2], also by Gustafson, are a more reasonable alternative to IEEE-754 floating point (but will still have a difficult time displacing IEEE-754, if they can at all). [1] http://web.stanford.edu/class/ee380/Abstracts/170201-slides.... [2] https://www.youtube.com/watch?v=aP0Y1uAA-2Y
Posits seem impressive. My only concern is the lack of NaNs seems like a bug rather than a feature. It's true that some programmers do the silliest things when faced with NaNs. But the fact is they are useful. You often want to do calculations over big matrices, where some elements simply don't have a mathematically defined answer (usually because of div0s but also because input data might have holes). It would be a…
Think of it this way: posits have a signaling NaN but do not have a quiet NaN.