5 ms·
I thought modern CPUs since the late 1980's used a lookup table for trig/transcendental functions. Is the LUT just an expansion of the polynomial? I never reall
by demondemidi 3y ago
I thought modern CPUs since the late 1980's used a lookup table for trig/transcendental functions. Is the LUT just an expansion of the polynomial? I never really understood how FPUs worked...
- Someone 3y agoThat would take way too much room. A full lookup table would have 2^64 entries of 64 bits each, at 2^70 bits of ROM. For comparison: - Apple’s M2 Ultra has about 134 billion transistors. That’s about 2^38. - Avogadro’s number is about 2^79. Reducing the argument to a small range around zero decreases that a lot, but not enough by a far stretch. There are 2^52 doubles in [0.5, 1.0), 2^52 more in [0.25, 0.5], 2^52 more in [0.125, 0.25], etc. so you’d still easily need 2^52 entries or 2^58 bits (likely way, way more)
- demondemidi 3y agoThey DO use a lookup table because that’s what the FDIV but came from: https://en.m.wikipedia.org/wiki/Pentium_FDIV_bug https://en.m.wikipedia.org/wiki/Pentium_FDIV_bug “It is implemented using a programmable logic array with 2,048 cells, of which 1,066 cells should have been populated with one of five values: −2, −1, 0, +1, +2.” Not sure what you’re trying to demonstrate, they wouldn’t store every single float!! I hope don’t program. ;)
- lifthrasiir 3y agoOlder CPUs generally have used CORDIC (which does use LUT but that's only a part of the algorithm) due to its simplicity and compactness, while later CPUs with extensive microcode support would do the same thing as software implementations.
- aidenn0 3y agoTFA says they use a 32 entry LUT, then do some math on the result.