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.
Modifier and Type | Class and Description |
---|---|
pack-priv static class | FdLibm.
Returns the arccosine of x. |
pack-priv static class | FdLibm.
Returns the arcsine of x. |
pack-priv static class | |
pack-priv static class | FdLibm.
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). |
pack-priv static class | FdLibm.
cbrt(x) Return cube root of x |
pack-priv static class | FdLibm.
cos(x) Return cosine function of x. |
pack-priv static class | FdLibm.
Method : mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 1. |
pack-priv static class | FdLibm.
Returns the exponential of x. |
pack-priv static class | |
pack-priv static class | FdLibm.
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.
__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.
Return the (natural) logarithm of x Method : 1. |
pack-priv static class | FdLibm.
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.
Returns the natural logarithm of the sum of the argument and 1. |
pack-priv static class | FdLibm.
Compute x**y n Method: Let x = 2 * (1+f) 1. |
pack-priv static class | FdLibm.
__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(x) Return sine function of x. |
pack-priv static class | FdLibm.
Method : mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 1. |
pack-priv static class | FdLibm.
Return correctly rounded sqrt. |
pack-priv static class | FdLibm.
tan(x) Return tangent function of x. |
pack-priv static class | FdLibm.
Return the Hyperbolic Tangent of x Method : x -x e - e 0. |
Modifier and Type | Field 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 |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static 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 | |
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.. |