I wonder: since there are only thirteen factorials that fit into int32, and thus only 13 possible valid inputs, is it faster or slower to use a very small lookup table? <a href="https://godbolt.org/g/9ii0S0" rel="nofollow">https://godbolt.org/g/9ii0S0</a> It seems like this is the sort of thing a good compiler can figure out on its own, but I don't fully understand what clang is doing with this loop: <a href="https://godbolt.org/g/ze5ycb" rel="nofollow">https://godbolt.org/g/ze5ycb</a>
People wanting to go from math to machine might like a work that starts with formal specs.<p><a href="http://www.cl.cam.ac.uk/~mom22/miniml/hol2miniml.pdf" rel="nofollow">http://www.cl.cam.ac.uk/~mom22/miniml/hol2miniml.pdf</a><p>The resulting ML can be compiled to assembly by verified, CakeML compiler.<p><a href="https://cakeml.org" rel="nofollow">https://cakeml.org</a>
This was neat. I enjoyed reading it. It wouldn't take much more to add the level below the machine code to this write up showing how the bits in the in the opcode generate control signals to carry out the micro-ops that make up the function.
If the author is reading this thread, would you please comment on how math expressions are rendered in your blog? The factorial definition near the beginning looks absolutely perfect. I'd like to learn how to do this in Jekyll.