Fast transcendent / trigonometric functions for Java

前端 未结 12 1858
面向向阳花
面向向阳花 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条回答
  •  时光说笑
    2020-11-29 02:31

    I haven't heard of any libs, probably because it's rare enough to see trig heavy Java apps. It's also easy enough to roll your own with JNI (same precision, better performance), numerical methods (variable precision / performance ) or a simple approximation table.

    As with any optimization, best to test that these functions are actually a bottleneck before bothering to reinvent the wheel.

提交回复
热议问题