3 ms·
One of the things I loved most about reading kernel and libc (or rather, libm) sources was the floating-point and FP emulation code. I thought it was immensely
by amiga386 3y ago
One of the things I loved most about reading kernel and libc (or rather, libm) sources was the floating-point and FP emulation code. I thought it was immensely cool to see what others just expected an FPU instruction to do, someone had not only written out in C, but also wrote comments explaining the mathematics (rendered in ASCII), often with numerical analysis about error propagation, accuracy, etc.
Some examples:
https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libm/math/e_pow.c https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=new...
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/math-emu/poly_sin.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/math-emu/README https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...