自定义数学函数与提供的数学函数? [英] Custom math functions vs. supplied Math functions?

查看:116
本文介绍了自定义数学函数与提供的数学函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上是在编写Java程序,该程序必须非常快地运行很多计算(每个帧的目标速度至少为30 f/s).这些将主要是三角函数和幂函数. 我要问的问题是: 哪个更快:使用Java Math已经提供的函数?还是编写自己的函数来运行?

I am basically making a Java program that will have to run a lot of calculations pretty quickly(each frame, aiming for at least 30 f/s). These will mostly be trigonometric and power functions. The question I'm asking is: Which is faster: using the already-supplied-by-Java Math functions? Or writing my own functions to run?

推荐答案

内置的Math函数将很难克服,因为它们中的大多数都具有使它们使用硬件内在函数的特殊JVM魔术.您可以通过很多来牺牲准确性而可以想象击败其中的一些,但是您很难击败Math否则实用程序.

The built-in Math functions will be extremely difficult to beat, given that most of them have special JVM magic that makes them use hardware intrinsics. You could conceivably beat some of them by trading away accuracy with a lot of work, but you're very unlikely to beat the Math utilities otherwise.

这篇关于自定义数学函数与提供的数学函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆