Top Description Constructors Methods
javax.vecmath

pack-priv Class VecMathUtil

extends Object
Class Inheritance

Utility vecmath class used when computing the hash code for vecmath objects containing float or double values. This fixes Issue 36.

Constructor Summary

AccessConstructor and Description
private
VecMathUtil()

Do not construct an instance of this class.

Method Summary

Modifier and TypeMethod and Description
pack-priv static long

Returns:

the integer bits representing that floating-point number, after first mapping -0.0f to 0.0f
doubleToLongBits
(double
an input double precision floating-point number
d
)

Returns the representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, after first mapping -0.0 to 0.0.

pack-priv static int

Returns:

the integer bits representing that floating-point number, after first mapping -0.0f to 0.0f
floatToIntBits
(float
an input floating-point number
f
)

Returns the representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, after first mapping -0.0 to 0.0.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

VecMathUtilback to summary
private VecMathUtil()

Do not construct an instance of this class.

Method Detail

doubleToLongBitsback to summary
pack-priv static long doubleToLongBits(double d)

Returns the representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, after first mapping -0.0 to 0.0. This method is identical to Double.doubleToLongBits(double) except that an integer value of 0L is returned for a floating-point value of -0.0. This is done for the purpose of computing a hash code that satisfies the contract of hashCode() and equals(). The equals() method in each vecmath class does a pair-wise "==" test on each floating-point field in the class (e.g., x, y, and z for a Tuple3d). Since 0.0 == -0.0 returns true, we must also return the same hash code for two objects, one of which has a field with a value of -0.0 and the other of which has a cooresponding field with a value of 0.0.

Parameters
d:double

an input double precision floating-point number

Returns:long

the integer bits representing that floating-point number, after first mapping -0.0f to 0.0f

floatToIntBitsback to summary
pack-priv static int floatToIntBits(float f)

Returns the representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, after first mapping -0.0 to 0.0. This method is identical to Float.floatToIntBits(float) except that an integer value of 0 is returned for a floating-point value of -0.0f. This is done for the purpose of computing a hash code that satisfies the contract of hashCode() and equals(). The equals() method in each vecmath class does a pair-wise "==" test on each floating-point field in the class (e.g., x, y, and z for a Tuple3f). Since 0.0f == -0.0f returns true, we must also return the same hash code for two objects, one of which has a field with a value of -0.0f and the other of which has a cooresponding field with a value of 0.0f.

Parameters
f:float

an input floating-point number

Returns:int

the integer bits representing that floating-point number, after first mapping -0.0f to 0.0f