JVM 是否仅支持 IEEE 754 所需功能的适当子集?
根据以下链接:
http://sonic.net/~jddarcy/Borneo/
http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
Java 仅支持 IEEE 754 标准的适当子集。这是否意味着所有 JVM 语言都是如此? (问题可以在字节码级别解决吗?)如果我想利用支持这些功能的硬件,有没有办法在 Oracle 的 JVM 上做到这一点?如果没有,是否存在可以做到这一点的分叉?
According to the following links:
http://sonic.net/~jddarcy/Borneo/
http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
Java only supports a proper subset of IEEE 754 standards. Does this mean this is the case for all JVM languages? (Is problem solvable at the bytecode level?) If I want to leverage hardware which support these features, is there a way to do this on Oracle's JVM? If not, does a fork exist that does?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,所有 JVM 语言都是如此。全局标志根本不存在。
不,没有办法解决这个问题。
更重要的是,不,你不应该。虽然卡汉教授可能是数值计算方面的专家,但他并不是软件工程方面的专家。他也无法预测未来。在当今的多核世界中,全局 FP 状态是一个非常糟糕的主意。为了合规性,您必须人为地将每个线程的 FP 状态融合到单个全局状态中,然后您无法再可靠地处理单个错误,因此您只能退出。太棒了。
Yes, this is the case for all JVM languages. The global flags just aren't there.
No, there's no way to fix this.
More importantly, no, you shouldn't. While Prof Kahan may be an expert on numerical computing, he's not on software engineering. Nor is he able to predict the future. Global FP state is a very bad idea in todays multi-core world. For compliance, you have to artificially fuse the FP state of each thread into a single global state, and then you cannot reliably deal with individual errors anymore so you just have to bail out. Just great.
如果您想利用 JVM 不使用的硬件特定功能,您可能需要使用 C 或汇编并通过 JNI 调用它。大多数代码仍然可以使用 Java,但不必解决所有问题。
注意:如果你这样做是出于性能原因,你必须小心你的“改进”实际上并没有变慢(有时慢得多)
If you want to leverage hardware specific features which the JVM does not use, you are likely to need to use C or assembly and call this via JNI. Most of your code can still be in Java, but it doesn't have to solve everything.
Note: if you are doing this for performance reason you have to be careful that your "improvement" is not actually slower (sometimes much slower)