HNHacker News
TopNewBestAskShowJobs

benrampling

14 karma · joined May 27, 2019

submissionscomments
benrampling··on The Most Effective Way to Learn New Words
One of the important Fluent Forever tips missing from this blob post is optimizing, as far as possible, the process of getting things into Anki, which is discussed here:

https://blog.fluent-forever.com/multi-search/

Extending the multi-search idea, with AnkiConnect (a REST API into your own local Anki database) and a little code (and a few tricks like disabling X-Frame-Options on sites like Google Images) you can get to the point where you just click on on the images/audio files you want in the flash cards.

benrampling··on Can you safely parse a double when you need a float?
Double rounding also occurred with the Intel x87 FPU (before compilers switched to using Intel SSE by default), which used 80-bit floating point registers internally that would then be rounded back to 64-bit on stores or spills. Because of that, you'll find double rounding discussed in FPU books and papers.

But the error from double rounding should be tiny, and occurs extremely rarely. The error from a single rounding (as you would get from parsing the float32 directly) is 0.5 ULP, and the error with 64-bit to 32-bit double-rounding should be 0.5 + 2^-30 ULP (an extra 2^-30 ULP) [1].

Comparing the two resulting 32-bit floats gives you the wrong impression about the actual additional error from double-rounding (the 2^-30 ULP, compared to the 0.5 ULP from going from a real number to floating point). For double-rounding to have any effect at all the real input number has to be extremely close to the midpoint of those two 32-bit floats, and the double rounding really just nudges it ~0.5 ULP's down instead of ~0.5 ULP's up (or vice versa).

And the chances of having a double rounding that affects the output is tiny; on the x87 it was approximately 1 in 4096 [2], and for float64 to float32 it's closer to one in a billion.

([1] When double rounding is odd - Normale, et al. - 2004, [2] Handbook of Floating-Point Arithmetic - Muller, et al. - 2010)

benrampling··on Text rendering using multi channel signed distance fields
There is a concise description of how this works (written by the author) here:

https://computergraphics.stackexchange.com/a/2151