logoalt Hacker News

AlotOfReadingtoday at 3:24 PM5 repliesview on HN

I'm pretty sure it's not faster, but it was fun to write:

    float asin(float x) {
      float x2 = 1.0f-fabs(x);
      u32 i = bitcast(x2);
      i = 0x5f3759df - (i>>1);
      float inv = bitcast(i);
      return copysign(pi/2-pi/2*(x2*inv),x);
    }
Courtesy of evil floating point bithacks.

Replies

jacquesmtoday at 5:18 PM

That could do with some subtitles.

show 1 reply
def-pri-pubtoday at 3:33 PM

> floating point bithacks

The forbidden magic

chuckadamstoday at 3:36 PM

You brought Zalgo. I blame this decade on you.

moffkalasttoday at 3:43 PM

> float asinine(float x) {

FTFY :P

adampunktoday at 4:09 PM

// what the fuck