Top Description Inners Fields Constructors Methods
java.lang

pack-priv final Class FdLibm

extends Object
Class Inheritance

Port of the "Freely Distributable Math Library", version 5.3, from C to Java.

The C version of fdlibm relied on the idiom of pointer aliasing a 64-bit double floating-point value as a two-element array of 32-bit integers and reading and writing the two halves of the double independently. This coding pattern was problematic to C optimizers and not directly expressible in Java. Therefore, rather than a memory level overlay, if portions of a double need to be operated on as integer values, the standard library methods for bitwise floating-point to integer conversion, Double.longBitsToDouble and Double.doubleToRawLongBits, are directly or indirectly used.

The C version of fdlibm also took some pains to signal the correct IEEE 754 exceptional conditions divide by zero, invalid, overflow and underflow. For example, overflow would be signaled by huge * huge where huge was a large constant that would overflow when squared. Since IEEE floating-point exceptional handling is not supported natively in the JVM, such coding patterns have been omitted from this port. For example, rather than return huge * huge, this port will use return INFINITY.

Various comparison and arithmetic operations in fdlibm could be done either based on the integer view of a value or directly on the floating-point representation. Which idiom is faster may depend on platform specific factors. However, for code clarity if no other reason, this port will favor expressing the semantics of those operations in terms of floating-point operations when convenient to do so.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
FdLibm.Acos

Returns the arccosine of x.

pack-priv static class
FdLibm.Asin

Returns the arcsine of x.

pack-priv static class
pack-priv static class
FdLibm.Atan2

Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).

pack-priv static class
FdLibm.Cbrt

cbrt(x) Return cube root of x

pack-priv static class
FdLibm.Cos

cos(x) Return cosine function of x.

pack-priv static class
FdLibm.Cosh

Method : mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 1.

pack-priv static class
FdLibm.Exp

Returns the exponential of x.

pack-priv static class
pack-priv static class
FdLibm.Hypot

hypot(x,y) Method : If (assume round-to-nearest) z = x*x + y*y has error less than sqrt(2)/2 ulp, than sqrt(z) has error less than 1 ulp (exercise).

pack-priv static class
pack-priv static class
FdLibm.KernelRemPio2

__kernel_rem_pio2(x,y,e0,nx,prec,ipio2) double x[],y[]; int e0,nx,prec; int ipio2[]; __kernel_rem_pio2 return the last three digits of N with y = x - N*pi/2 so that |y| < pi/2.

pack-priv static class
FdLibm.Log

Return the (natural) logarithm of x Method : 1.

pack-priv static class
FdLibm.Log10

Return the base 10 logarithm of x Method : Let log10_2hi = leading 40 bits of log10(2) and log10_2lo = log10(2) - log10_2hi, ivln10 = 1/log(10) rounded.

pack-priv static class
FdLibm.Log1p

Returns the natural logarithm of the sum of the argument and 1.

pack-priv static class
FdLibm.Pow

Compute x**y n Method: Let x = 2 * (1+f) 1.

pack-priv static class
FdLibm.RemPio2

__ieee754_rem_pio2(x,y) return the remainder of x rem pi/2 in y[0]+y[1] use __kernel_rem_pio2()

pack-priv static class
FdLibm.Sin

sin(x) Return sine function of x.

pack-priv static class
FdLibm.Sinh

Method : mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 1.

pack-priv static class
FdLibm.Sqrt

Return correctly rounded sqrt.

pack-priv static class
FdLibm.Tan

tan(x) Return tangent function of x.

pack-priv static class
FdLibm.Tanh

Return the Hyperbolic Tangent of x Method : x -x e - e 0.

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final double
private static final double
private static final int
private static final double
private static final double

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static int
__HI(double x)

Return the high-order 32 bits of the double argument as an int.

private static double
__HI(double x, int high)

Return a double with its high-order bits of the second argument and the low-order bits of the first argument..

private static double
__HI_LO(int high, int low)

Return a double with its high-order bits of the first argument and the low-order bits of the second argument..

private static int
__LO(double x)

Return the low-order 32 bits of the double argument as an int.

private static double
__LO(double x, int low)

Return a double with its low-order bits of the second argument and the high-order bits of the first argument..

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait