From 78f6de75d2645a8cc0c6df0f1f2d01d81645f3de Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Thu, 25 Apr 2024 03:20:14 +0200 Subject: FloatUtil: Add IEC559_SIGN_BIT; Align API doc and implementation w/ native jaulib, i.e. drop 0==epsilon case for performance --- src/jogl/classes/com/jogamp/math/FloatUtil.java | 63 ++++++++++++++--------- src/jogl/classes/com/jogamp/math/geom/AABBox.java | 2 +- 2 files changed, 41 insertions(+), 24 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/jogamp/math/FloatUtil.java b/src/jogl/classes/com/jogamp/math/FloatUtil.java index 4ca706457..b8eebf0b3 100644 --- a/src/jogl/classes/com/jogamp/math/FloatUtil.java +++ b/src/jogl/classes/com/jogamp/math/FloatUtil.java @@ -1278,7 +1278,7 @@ public final class FloatUtil { * @param aOffset offset to a's current position * @param rows * @param columns - * @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL) + * @param rowMajorOrder if true floats are laid out in row-major-order, otherwise column-major-order (OpenGL) * @return matrix string representation */ public static StringBuilder matrixToString(StringBuilder sb, final String rowPrefix, final String f, @@ -1410,8 +1410,12 @@ public final class FloatUtil { */ public static final float INV_DEVIANCE = 1.0E-5f; // FloatUtil.EPSILON == 1.1920929E-7f; double ALLOWED_DEVIANCE: 1.0E-8f + /** Signed bit 31 of IEEE 754 (IEC 559) single float-point bit layout, i.e. `0x80000000`. */ + public static final int IEC559_SIGN_BIT = 1 << 31; // 0x80000000; + /** - * Return true if both values are equal w/o regarding an epsilon. + * Returns true if both values are equal + * disregarding {@link EPSILON} but considering {@code NaN}, {@code -Inf} and {@code +Inf}. *

* Implementation considers following corner cases: *