Fast transcendent / trigonometric functions for Java

前端 未结 12 1857
面向向阳花
面向向阳花 2020-11-29 02:06

Since the trigonometric functions in java.lang.Math are quite slow: is there a library that does a quick and good approximation? It seems possible to do a calculation severa

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 02:37

    Check out Apache Commons Math package if you want to use existing stuff.

    If performance is really of the essence, then you can go about implementing these functions yourself using standard math methods - Taylor/Maclaurin series', specifically.

    For example, here are several Taylor series expansions that might be useful (taken from wikipedia):

    alt text

    alt text

    alt text

提交回复
热议问题