tag:blogger.com,1999:blog-5246987755651065286.post5092016683689426971..comments2023-03-24T22:50:18.274-07:00Comments on cbloom rants: 05-26-09 - Storing Floating Pointscbloomhttp://www.blogger.com/profile/10714564834899413045noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-5246987755651065286.post-25543059567745323792009-05-28T08:51:53.513-07:002009-05-28T08:51:53.513-07:00The graphics formats like float16, float11/10, and...The graphics formats like float16, float11/10, and the 360-specific one that is 7e3 all use tricks like this to focus precision where it's needed - though there's some argument as to whether 7e3 did a good job or if 6e4 would have been a better choice.<br /><br />As well as changing bit sizes, many of these have biases on the exponents to focus the precision away from 0-1, and all require full-speed support of denormals.Tom Forsythhttps://www.blogger.com/profile/01368434932814120414noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-73266038856273131782009-05-27T18:03:12.341-07:002009-05-27T18:03:12.341-07:00see:
http://www.cc.gatech.edu/~lindstro/
http://...see:<br /><br />http://www.cc.gatech.edu/~lindstro/<br /><br />http://www.cs.unc.edu/~isenburg/<br /><br />in particular :<br /><br />http://www.cs.unc.edu/~isenburg/lcpfpv/cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-34935295074434823192009-05-27T17:58:33.572-07:002009-05-27T17:58:33.572-07:00addendum :
I just discovered this is basically th...addendum :<br /><br />I just discovered this is basically the Lindstrom "fast efficient floating point" method.cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-38899217774415607302009-05-26T16:59:43.484-07:002009-05-26T16:59:43.484-07:00Yeah, it is probably no good to depend on IEE754 c...Yeah, it is probably no good to depend on IEE754 compliance or the lack thereof. Then again, I think something like "flush to zero" is pretty common on the platforms you likely care about. Maybe you can just use that as part of the quantizer.won3dhttps://www.blogger.com/profile/09787472194187459747noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-23728277569079783082009-05-26T16:50:50.313-07:002009-05-26T16:50:50.313-07:00That should work, but that limits your code to pla...That should work, but that limits your code to platforms and environments that are really IEEE compliant; e.g. SPUs don't have denormals IIRC and on PCs, you can switch SSE computations to "flush to zero" mode where denormals are automatically truncated to zero instead of going through a painfully slow microcoded path. Other CPUs have a similar mode. You'd have to be careful to make sure that you're in IEEE compliant mode before using real denormals, and even so, brace yourself for a serious performance impact - denormals are very rare in normal computations, so the hardware implementations are seriously slow, as in "microcoded with no concurrent completion of other FP ops" slow. If there's a significant percentage of values in that range (and after all that's the whole point), you're most likely better off implementing this manually. That's something I'd check, though, but at least a few years ago, the penalty for having lots of denormals in your calculation were severe - I've seen slowdowns of factor 200 and more. (DSP apps like IIR filters and comb filters are notorious for this: if your source signal goes to zero and stays there for a few seconds, the time spent in these filters will suddenly explode as the state variables all go denormal around the same time, unless you manually clamp them to zero).ryghttps://www.blogger.com/profile/03031635656201499907noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-91263352526061002992009-05-26T16:42:22.732-07:002009-05-26T16:42:22.732-07:00Yeah if I understand you correctly I believe you a...Yeah if I understand you correctly I believe you are right.<br /><br />Basically with a normal IEEE 32 bit float you have 127*2^23 values between 1.0 and 0. You can reduce that gap by multiplying your number by a large negative power of two.<br /><br />So, like if you want almost no gap, you multiply your number by 2^-127 first, then I can just grab the E & M straight out of the floating pointer number and it will do the denorm for me.cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-27076634814301834922009-05-26T16:10:15.673-07:002009-05-26T16:10:15.673-07:00The observation that floats form a piecewise linea...The observation that floats form a piecewise linear approximation of lg is a neat one, and is how Blinn and the old school guys used to do wacky approximations of various transcendentals. Always a crowd pleaser.<br /><br />But regarding negative exponents, exponents are stored in IEE754 as biased numbers, not 2s-complement. So, isn't your "gap at 0" a question of degrees? Like, correctable via a power-of-2 multiplicative bias (aka scalb). Then, wouldn't your "denorms" just be actual denorms?won3dhttps://www.blogger.com/profile/09787472194187459747noreply@blogger.com