faster Math.exp() via JNI?

前端 未结 15 654
时光取名叫无心
时光取名叫无心 2021-01-11 22:43

I need to calculate Math.exp() from java very frequently, is it possible to get a native version to run faster than java\'s Math.exp()

15条回答
  •  南方客
    南方客 (楼主)
    2021-01-11 23:34

    There are faster algorithms for exp depending on what your'e trying to accomplish. Is the problem space restricted to a certain range, do you only need a certain resolution, precision, or accuracy, etc.

    If you define your problem very well, you may find that you can use a table with interpolation, for instance, which will blow nearly any other algorithm out of the water.

    What constraints can you apply to exp to gain that performance trade-off?

    -Adam

提交回复
热议问题