And to make it even faster

Jump to navigation Jump to search
Revision as of 23 September 2017 at 12:45.
The highlighted comment was created in this revision.

And to make it even faster

       double x = bulletSpeed;
       double a = -3.508129323E-5;
       double b = 2.460363294E-3;
       double c = -6.666318894E-2;
       double d = 8.545020365E-1;
       double e = -3.337830707;
       double angle = a * x * x * x * x + b * x * x * x + c * x * x + d * x + e;
       return Math.sin(angle) / (bulletSpeed / 8 - Math.cos(angle));
    Xor (talk)14:33, 23 September 2017

    btw, you can try newton's method to find the max value ;)

      Xor (talk)14:40, 23 September 2017

      I know. But calculated numbers weren't exact and Wolfram Alpha's computation time exceeds.

        Dsekercioglu (talk)14:43, 23 September 2017
         

        Precision is up to 9 numbers. I think that it is enough.

          Dsekercioglu (talk)14:45, 23 September 2017