Java双epsilon [英] Java double epsilon

查看:56
本文介绍了Java双epsilon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前需要类型为double epsilon (首选Java库中的常量,而不是自己的实现/定义)

据我所知Double具有MIN_VALUEMAX_VALUE作为静态成员. 为什么没有EPSILON?

epsilon<double>是什么?

std::numeric_limits< double >::epsilon()有什么区别吗?

I'm currently in the need of an epsilon of type double (preferred are constants in java's libraries instead of own implementations/definitions)

As far as I can see Double has MIN_VALUE and MAX_VALUE as static members.

Why there is no EPSILON?

What would a epsilon<double> be?

Are there any differences to a std::numeric_limits< double >::epsilon()?

Epsilon:1与最小值之间的差,可以表示数据类型.

Epsilon: The difference between 1 and the smallest value greater than 1 that is representable for the data type.

推荐答案

我假设您是指ε值的错误.即.

I'm presuming you mean epsilon in the sense of the error in the value. I.e this.

如果是这样,则在Java中将其称为ULP(最后一个单元).您可以使用java.lang.Math包和Math.ulp()方法找到它.请参见此处的Javadocs .

If so then in Java it's referred to as ULP (unit in last place). You can find it by using the java.lang.Math package and the Math.ulp() method. See javadocs here.

该值未存储为静态成员,因为根据所关注的双精度值的不同,该值将有所不同.

The value isn't stored as a static member because it will be different depending on the double you are concerned with.

编辑:根据当前问题中OP对epsilon的定义,双精度值1.0的ULP为2.220446049250313E-16,表示为双精度值. (即Math.ulp(1.0)的返回值.)

By the OP's definition of epsilon now in the question, the ULP of a double of value 1.0 is 2.220446049250313E-16 expressed as a double. (I.e. the return value of Math.ulp(1.0).)

这篇关于Java双epsilon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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