Remix.run Logo
AlotOfReading 6 hours ago

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.
jacquesm 5 hours ago | parent | next [-]

That could do with some subtitles.

irishcoffee 4 hours ago | parent [-]

https://en.wikipedia.org/wiki/Fast_inverse_square_root

def-pri-pub 6 hours ago | parent | prev | next [-]

> floating point bithacks

The forbidden magic

chuckadams 6 hours ago | parent | prev | next [-]

You brought Zalgo. I blame this decade on you.

moffkalast 6 hours ago | parent | prev | next [-]

> float asinine(float x) {

FTFY :P

adampunk 6 hours ago | parent | prev [-]

// what the fuck