"Depending on what else is going on, I think you can sometimes get sin & cos for the same cost as 1 add instruction"
#shithnsays
-
-
Replying to @stephentyrone
maybe if your add instructions are really expensive
1 reply 0 retweets 0 likes -
Replying to @whitequark
Actually they're faster than an add! float sin(float x) { return x; } float cos(float x) { return 1; }
2 replies 0 retweets 13 likes -
-
-
Replying to @stephentyrone @whitequark
Hey, they're correct for all denormal inputs.
1 reply 0 retweets 2 likes -
Replying to @RichFelker @whitequark
They're correct for almost half of the possible floating-point inputs!
1 reply 0 retweets 5 likes -
Replying to @stephentyrone @whitequark
Perhaps for a minor stretch of "almost half". Looks like only about 46% of the exponent space for single precision. :-)
1 reply 0 retweets 1 like
BTW, having a REPL for C floating point expressions is very handy. I just have a cheap RPN one I threw together a while back for stuff like this.
7:50 AM - 6 Mar 2018
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.