News for hackers. Stuff that matters.
Re:Implementing Cosine in C from Scratch (2020) by lifthrasiir on Tuesday March 29, 2022 @04:50PM (#30848185)
It does use Horner's rule, but splits the expression into two halves in order to exploit instruction-level parallelism.
Re:Implementing Cosine in C from Scratch (2020) by jacobolus on Tuesday March 29, 2022 @05:27PM (#30848606)
Considering the form of both halves is the same, are compilers smart enough to vectorize this code?
Re:Implementing Cosine in C from Scratch (2020) by adgjlsfhk1 on Tuesday March 29, 2022 @07:29PM (#30849661)
I might be wrong but I would think for something like this vectorizing wouldn't save time (since you would have to move data around before and afterwards. The real benefit of this is it lets you run two fma operations in parallel.