繁体   English   中英

是否有任何符合IEEE754(r)的Java实现?

[英]Any IEEE754(r) compliant implementations for Java?

是否有可用于Java的完全兼容的IEEE754r实现,可为Java选择忽略的所有功能提供支持(或者一般来说,高层语言则希望省略):

  • 陷阱
  • 粘性标志
  • 定向舍入模式
  • 加长/长双
  • 四精度
  • DPD(密集包装的小数)

在任何人弄错之前澄清一下:我并不是在寻找JVM为上述内容提供任何支持,只是有些类确实在软件中实现了类型和操作,基本上是已经存在的primitve包装类的样式Float /双。

不,不存在完全兼容的IEEE754R实现。 不仅使用Java,而且使用所有当前可用的语言(2012年7月,状态)。

编辑:海报要求与IEEE 754-2008相同的IEEE754 R支持。 如果我要添加所有没有此类原因的原因,那将会很长。

  • 陷阱:不,使用SIGFPE用OVERFLOW,UNDERFLOW,INEXACT等调用自己的例程不是陷阱。 请参见IEEE754(旧的)。 21是什么构成陷阱。 信号NaN。 NaN有效负载访问。 标记访问。 列举可以做到这一点的语言。

  • 舍入模式:新标准将roundTiesToAway(第16页)定义为新的舍入模式。 不幸的是,没有AFAIK没有支持该模式的处理器,也没有软件仿真。

  • 四精度:仅在很少的编译器中支持,甚至更少的编译器也受支持。

  • 密集包装的小数:仅在使用小数的语言(例如COBOL)中受支持。

所有集合的交集:空集合。 没有。 没有。

与以下实现的功能如下:

double nextAfter(double x, double y) - returns the double adjacent to x in the direction of y
    double scalb(double x, int e) - computes x*2e quickly
    boolean unordered(double c1, double c2) - returns true iff the two cannot be compared numerically (one or both is NaN)
    int fpclassify(double value) - classifies a floating-point value into one of five types:
        FP_NAN: "not any number", typically the result of illegal operations like 0/0
        FP_INFINITY: represents one end of the real line, available by 1/0 or POSITIVE_INFINITY
        FP_ZERO: positive or negative zero; they are different, but not so much that it comes up much
        FP_SUBNORMAL: a class of numbers very near zero; further explanation would require a detailed examination of the floating-point binary representation
        FP_NORMAL: most values you encounter are "normal" 
    double copySign(double value, double sign) - returns value, possibly with its sign flipped, to match "sign"
    double logb754(double value) - extracts the exponent of the value, to compute log2
    double logb854(double value) - like logb754(value), but with an IEEE854-compliant variant for subnormal numbers
    double logbn(double value) - also computing log2(value), but with a normalizing correction for the subnormals; this is the best log routine
    double raise(double x) - not actually an IEEE754 routine, this is an optimized version of nextAfter(x,POSITIVE_INFINITY)
    double lower(double x) - not actually an IEEE754 routine, this is an optimized version of nextAfter(x,NEGATIVE_INFINITY) 

“所有这些例程还具有float变体,仅在参数和返回类型上有所不同。该类为org.dosereality.util.IEEE754”

Sun Bug参考2003

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM