5 ms·
Half-Precision Floating-Point, Visualized
- kordlessagain 6y agoAfter the page loaded, I tried to use a two finger scroll on my laptop, at which point some graph on the page began scaling itself instead of the page scrolling.
- lalaithion 6y agoI wondered why half of the graphs were entirely empty before I realized that I had zoomed into them by mistake.
- jgalt212 6y agobetter than half precision, but will still burn you is the FLOAT type in MySQL. It's single precision, not double precision, which is expected these days in floats. https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html https://dev.mysql.com/doc/refman/8.0/en/floating-point-types...
- Firadeoclus 6y ago> double precision, which is expected these days in floats. Some people will expect it to be double precision (e.g. Python programmers) whereas others will expect it to be single precision (e.g. C/C++ programmers).
- nmca 6y agoPet peeve of mine when people call these types anything other than f32, f64 etc. Surely we should have learned by now!
- thechao 6y agoWhich f16? For GPUs I know of three format-different fp’s used in common practice. For f32 there’s (generally) two format compatible, semantic diverging variants. And that doesn’t even take into account sub-behaviors of “standard” IEEE-754.
- jgalt212 6y agofair enough, but I guess we can agree then that "float" is a vague term. And when a term is vague, it's probably best to default to the least likely to do damage actual definition.
- jleedev 6y agoMysql also applies additional rounding to floats if you're not careful: mysql> create table t(f float); Query OK, 0 rows affected (0.02 sec) mysql> insert into t(f) values (999999),(1000000),(1000001); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> select distinct f from t; +---------+ | f | +---------+ | 999999 | | 1000000 | | 1000000 | +---------+ 3 rows in set (0.00 sec) mysql>
- fractionalhare 6y agoCool! That first visualization is a nicer version of one I made in the past to show the distribution of half-precision floating point values. Mine color codes the density of values in subintervals rather than by their category: https://www.pseudorandom.com/implementing-exp#section-3 https://www.pseudorandom.com/implementing-exp#section-3 I'm not usually a fan of interactive plots but I think the one in this article works. It's cool to hover over individual areas and see the significand, exponent and sign bit listed for different values.