Fast transcendent / trigonometric functions for Java

前端 未结 12 1826
面向向阳花
面向向阳花 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:32

    On the x86 the java.lang.Math sin and cos functions do not directly call the hardware functions because Intel didn't always do such a good job implimenting them. There is a nice explanation in bug #4857011.

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4857011

    You might want to think hard about an inexact result. It's amusing how often I spend time finding this in others code.

    "But the comment says Sin..."

提交回复
热议问题