Package com.imsl.math
Class IEEE
java.lang.Object
com.imsl.math.IEEE
Pure Java implementation of the IEEE 754 functions
as specified in IEEE Standard for Binary Floating-Point Arithmetic,
ANSI/IEEE Standard 754-1985 (IEEE, New York).
This Java code is based on C code in the package fdlibm, which can be obtained from www.netlib.org. The original fdlibm C code contains the following notice.
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunSoft, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
- Author:
- Sun Microsystems (original C code in fdlibm), John F. Brophy (translated from C to Java)
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublecopysign(double x, double y) Returns a value with the magnitude of x and with the sign bit of y.static booleanfinite(double x) Finite number test on an argument of type double.static intilogb(double x) Return the binary exponent of non-zero x.static booleanisNaN(double x) NaN test on an argument of type double.static doublenextAfter(double x, double y) Returns the next machine floating-point number next to x in the direction toward y.static doublescalbn(double x, int n) Returns \(x\,2^n\) computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication.static booleanunordered(double x, double y) Unordered test on a pair ofdoubles.
-
Method Details
-
copysign
public static double copysign(double x, double y) Returns a value with the magnitude of x and with the sign bit of y. If y is NaN then |x| is returned.- Parameters:
x- adoublefrom which the magnitude will be gleanedy- adoublefrom which the sign will be gleaned- Returns:
- a
doublevalue with magnitude x and sign of y
-
finite
public static boolean finite(double x) Finite number test on an argument of type double.- Parameters:
x- thedoublewhich is to be tested- Returns:
- true if x is a finite number, false if x is a NaN or an infinity
-
isNaN
public static boolean isNaN(double x) NaN test on an argument of type double.- Parameters:
x- thedoublewhich is to be tested- Returns:
- true if x is a NaN, false otherwise
-
unordered
public static boolean unordered(double x, double y) Unordered test on a pair ofdoubles. Tests whether either of a pair ofdoubles is a NaN.- Parameters:
x- adoubley- adouble- Returns:
- true if either x or y is a NaN, false otherwise
-
nextAfter
public static double nextAfter(double x, double y) Returns the next machine floating-point number next to x in the direction toward y.- Parameters:
x- adoubley- adouble- Returns:
- a
doublewhich represents the value which is closest to x in the interval bounded by x and y
-
scalbn
public static double scalbn(double x, int n) Returns \(x\,2^n\) computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication.- Parameters:
x- adoublen- anintrepresenting the power to which 2 is raised- Returns:
- a
doublerepresenting \(x\,2^n\).
-
ilogb
public static int ilogb(double x) Return the binary exponent of non-zero x.- Parameters:
x- adouble- Returns:
- an
intrepresenting the binary exponent of x. Special casesilogb(0) = -Integer.MAX_VALUEand \({\rm {ilogb}} (\infty) = {\rm {ilogb}} (-\infty) = {\rm {ilogb}} (NaN) = {\rm {Integer.MAX\_VALUE}}\). - See Also:
-