epsilon.java~1~
来自「一个一元曲线多项式数值演示例子」· JAVA~1~ 代码 · 共 37 行
JAVA~1~
37 行
package numbercruncher.mathutils;/** * Compute the machine epsilon for the float and double types, * the largest positive floating-point value that, when added to 1, * results in a value equal to 1 due to roundoff. */public final class Epsilon{ private static final float floatEpsilon; private static final double doubleEpsilon; static { // Loop to compute the float epsilon value. float fTemp = 0.5f; while (1 + fTemp > 1) fTemp /= 2; floatEpsilon = fTemp; // Loop to compute the double epsilon value. double dTemp = 0.5; while (1 + dTemp > 1) dTemp /= 2; doubleEpsilon = dTemp; }; /** * Return the float epsilon value. * @returns the value */ public static float floatValue() { return floatEpsilon; } /** * Return the double epsilon value. * @returns the value */ public static double doubleValue() { return doubleEpsilon; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?