News for hackers. Stuff that matters.
Re:Cosine Implementation in C by stkdump on Friday March 31, 2023 @03:04AM (#35383652)
CPUs do have a 'hardware' (I guess microcode) implementation in the 80387 era FPU. But it isn't used. One reason is that the software implementation is faster in modern floating point code. I don't know about GPUs but I would guess compilers transparently take care of that.
Re:Cosine Implementation in C by sacnoradhq on Friday March 31, 2023 @03:35AM (#35383870)
It depends on the precision and accuracy and data types of the arguments and result. The 80387 was absolutely faster than software emulation for F32/64/80 by hooking real-mode interrupt handlers the way it was back to the 8086/8087. For I8/16, lookup tables were faster. For I32, a quality result would be very expensive. There were no GPUs in the 387 era, and there wasn't SIMD (MMX) either. In the x86 era, compilers weren't that smart. If they were, then they were slow.
Re:Cosine Implementation in C by adgjlsfhk1 on Friday March 31, 2023 @08:40AM (#35386211)
the real problem is Intel screwed up their sin implementation by only using 66 bits of pi and then refused to fix it.