JVM 是否仅支持 IEEE 754 所需功能的适当子集?

发布于 2024-12-04 03:40:06 字数 390 浏览 1 评论 0原文

根据以下链接:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情独悲 2024-12-11 03:40:06

是的,所有 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.

爱要勇敢去追 2024-12-11 03:40:06

如果您想利用 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文