public class Mpfr extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Mpfr>, java.lang.Cloneable
This class wraps mpfr_t
MPFR objects.
The precision of each number is set at construction time and not
changed when the number is modified (except by setPrec(int)
or
set(Mpfr)
).
Thus, most operators entail rounding. Such operators take as (last)
argument a rounding direction that can be RNDN
, RNDZ
,
RNDU
, or RNDD
).
Most operators return an integer that tells whether the stored result is exact (zero returned), over-approximated (positive number returned), or under-approximated (negative number returned).
In addition, the class has some global (static) exception flags that can be set by methods to denote IEEE 754 exceptions, and then inspected and reset by the user: overflow, underflow, NaN, inexact, and erange (invalid range) flags (these do not cause Java exceptions to be thrown).
Modifier and Type | Field and Description |
---|---|
static int |
RNDD
Rounds toward minus infinity.
|
static int |
RNDN
Rounds to nearest.
|
static int |
RNDU
Rounds toward plus infinity.
|
static int |
RNDZ
Rounds toward zero.
|
Constructor and Description |
---|
Mpfr()
Constructs a new number with the default precision.
|
Mpfr(java.math.BigInteger v,
int round)
Constructs a float with the default precision equal to an integer
(with rounding).
|
Mpfr(double v,
int round)
Constructs a float with the default precision equal to a double
(with rounding).
|
Mpfr(int prec)
Constructs a new number with exactly prec bits of precision.
|
Mpfr(int v,
int round)
Constructs a float with the default precision equal to an integer
(with rounding).
|
Mpfr(Mpfr v)
Constructs a copy of v, with the same precision as v.
|
Mpfr(Mpfr v,
int round)
Constructs a copy of v, rounded to the default precision.
|
Mpfr(Mpq v,
int round)
Constructs a float with the default precision equal to a fraction
(with rounding).
|
Mpfr(Mpz v,
int round)
Constructs a float with the default precision equal to an integer
(with rounding).
|
Mpfr(java.lang.String s,
int round)
Constructs a float with the default precision equal to the number
represented in the decimal String s (with rounding).
|
Mpfr(java.lang.String s,
int b,
int round)
Constructs a float with the default precision equal to the number
represented in the String s in base b (with rounding).
|
Modifier and Type | Method and Description |
---|---|
int |
abs(int round)
Takes the absolute value of this.
|
int |
abs(Mpfr op,
int round)
Sets this to |op|.
|
int |
acos(Mpfr op,
int round)
Sets this to the arc-cosine of op.
|
int |
acosh(Mpfr op,
int round)
Sets this to the hyperbolic arc-cosine of op.
|
int |
add(double op,
int round)
Adds op to this.
|
int |
add(int op,
int round)
Adds op to this.
|
int |
add(Mpfr op1,
double op2,
int round)
Sets this to op1+op2.
|
int |
add(Mpfr op,
int round)
Adds op to this.
|
int |
add(Mpfr op1,
int op2,
int round)
Sets this to op1+op2.
|
int |
add(Mpfr op1,
Mpfr op2,
int round)
Sets this to op1+op2.
|
int |
add(Mpfr op1,
Mpq op2,
int round)
Sets this to op1+op2.
|
int |
add(Mpfr op1,
Mpz op2,
int round)
Sets this to op1+op2.
|
int |
add(Mpq op,
int round)
Adds op to this.
|
int |
add(Mpz op,
int round)
Adds op to this.
|
int |
agm(Mpfr op1,
Mpfr op2,
int round)
Sets this to the arithmetic-geometric mean of op1 and op2.
|
int |
asin(Mpfr op,
int round)
Sets this to the arc-sine of op.
|
int |
asinh(Mpfr op,
int round)
Sets this to the hyperbolic arc-sine of op.
|
int |
atan(Mpfr op,
int round)
Sets this to the arc-tangent of op.
|
int |
atan2(Mpfr y,
Mpfr x,
int round)
Sets this to the arc-tangent2 of y and x.
|
int |
atanh(Mpfr op,
int round)
Sets this to the hyperbolic arc-tangent of op.
|
boolean |
canRound(int err,
int round1,
int round2,
int prec)
Whether this can be rounded without loss of precision.
|
int |
cbrt(int round)
Takes the cubic root of this.
|
int |
cbrt(Mpfr op,
int round)
Sets this to the cubic root of op.
|
int |
ceil(Mpfr op)
Stores into this, op rounded to the next representable integer.
|
int |
checkRange(int t,
int round)
Forces this to be in the current range of acceptable values.
|
static void |
clearERangeFlag()
Clears the erange (invalid range) flag.
|
static void |
clearInexFlag()
Clears the inexact flag.
|
static void |
clearNaNFlag()
Clears the invalid flag.
|
static void |
clearOverflow()
Clears the overflow flag.
|
static void |
clearUnderflow()
Clears the underflow flag.
|
Mpfr |
clone()
Creates a new Mpfr initialized with the value of this.
|
int |
cmp(double op)
Compares this to op.
|
int |
cmp(int op)
Compares this to op.
|
int |
cmp(Mpfr op)
Compares this to op.
|
int |
cmp(Mpq op)
Compares this to op.
|
int |
cmp(Mpz op)
Compares this to op.
|
int |
cmp2exp(int op,
int e)
Compares this to op*2^e.
|
int |
cmpAbs(Mpfr op)
Compares |this| to |op|.
|
int |
compareTo(Mpfr x)
Compare the value of this and x.
|
int |
constCatalan(int round)
Sets this to Catalan's constant.
|
int |
constEuler(int round)
Sets this to Euler's constant.
|
int |
constLog2(int round)
Sets this to the constant log(2).
|
int |
constPi(int round)
Sets this to the constant pi.
|
int |
copySign(Mpfr op1,
Mpfr op2,
int round)
Sets this to op1 (rounded), and then sets the bit-sign of this to
that of op2.
|
int |
cos(Mpfr op,
int round)
Sets this to the cosine of op.
|
int |
cosh(Mpfr op,
int round)
Sets this to the hyperbolic cosine of op.
|
int |
cot(Mpfr op,
int round)
Sets this to the cotangent of op.
|
int |
coth(Mpfr op,
int round)
Sets this to the hyperbolic cotangent of op.
|
int |
csc(Mpfr op,
int round)
Sets this to the cosecant op.
|
int |
csch(Mpfr op,
int round)
Sets this to the hyperbolic cosecant op.
|
int |
dim(Mpfr op1,
Mpfr op2,
int round)
Sets this to max(0, op1-op2).
|
int |
div(double op,
int round)
Divides this by op.
|
int |
div(double op1,
Mpfr op2,
int round)
Sets this to op1/op2.
|
int |
div(int op,
int round)
Divides this by op.
|
int |
div(int op1,
Mpfr op2,
int round)
Sets this to op1/op2.
|
int |
div(Mpfr op1,
double op2,
int round)
Sets this to op1/op2.
|
int |
div(Mpfr op,
int round)
Divides this by op.
|
int |
div(Mpfr op1,
int op2,
int round)
Sets this to op1/op2.
|
int |
div(Mpfr op1,
Mpfr op2,
int round)
Sets this to op1/op2.
|
int |
div(Mpfr op1,
Mpq op2,
int round)
Sets this to op1/op2.
|
int |
div(Mpfr op1,
Mpz op2,
int round)
Sets this to op1/op2.
|
int |
div(Mpq op,
int round)
Divides this by op.
|
int |
div(Mpz op,
int round)
Divides this by op.
|
int |
div2exp(int op,
int round)
Divides this by 2^op.
|
int |
div2exp(Mpfr op1,
int op2,
int round)
Sets this to op1/(2^op2).
|
int |
divRev(double op,
int round)
Stores op/this into this.
|
int |
divRev(int op,
int round)
Stores op/this into this.
|
double |
doubleExponentValue(int[] r,
int round)
Converts the integer to a mantissa and exponent.
|
double |
doubleValue(int round)
Returns this as a double (with rounding).
|
int |
eint(Mpfr op,
int round)
Sets this to the exponential integral of op.
|
boolean |
equals(java.lang.Object x)
Whether x is a Mpfr and has the same value as this.
|
int |
erf(Mpfr op,
int round)
Sets this to the value of the error function at op.
|
int |
erfc(Mpfr op,
int round)
Sets this to the value of the complementary error function at op.
|
int |
exp(Mpfr op,
int round)
Sets this to e^op.
|
int |
exp10(Mpfr op,
int round)
Sets this to 10^op.
|
int |
exp2(Mpfr op,
int round)
Sets this to 2^op.
|
int |
expm1(Mpfr op,
int round)
Sets this to exp(op-1).
|
int |
fac(int i,
int round)
Sets this to i!.
|
protected void |
finalize()
Deallocates the underlying mpfr_t MPFR object.
|
boolean |
fitsInt(int round)
Whether this converted to integer (with rounding) fits in an int.
|
int |
floor(Mpfr op)
Stores into this, op rounded to the previous representable integer.
|
int |
fma(Mpfr op1,
Mpfr op2,
Mpfr op3,
int round)
Sets this to (op1*op2)+op3.
|
int |
fmod(Mpfr x,
Mpfr y,
int round)
Sets this to x-y*trunc(x/y).
|
int |
fms(Mpfr op1,
Mpfr op2,
Mpfr op3,
int round)
Sets this to (op1*op2)-op3.
|
int |
frac(Mpfr op,
int round)
Stores into this, the fractional part of op with the same sign as op,
and rounded.
|
static void |
freeCache()
Free various caches used internally to compute functions
and constants.
|
int |
gamma(Mpfr op,
int round)
Sets this to the value of the Gamma function at op.
|
static int |
getDefaultPrec()
Returns the default precision, in bits.
|
static long |
getEmax()
Returns the current largest exponent allowed for a floating-point
variable.
|
static long |
getEmaxMax()
Returns the largest value allowed in
setEmax(long) . |
static long |
getEmaxMin()
Returns the smallest value allowed in
setEmax(long) . |
static long |
getEmin()
Returns the current smallest exponent allowed for a floating-point
variable.
|
static long |
getEminMax()
Returns the largest value allowed in
setEmin(long) . |
static long |
getEminMin()
Returns the smallest value allowed in
setEmin(long) . |
int |
getExp()
Returns the exponent of this.
|
static java.lang.String |
getPatches()
Returns the ids of the patches applied to the MPFR library.
|
int |
getPrec()
Returns the precision of this, in bits.
|
static java.lang.String |
getVersion()
Returns the MPFR version.
|
int |
hashCode()
Returns a hash of the value of this.
|
int |
hypot(Mpfr y,
Mpfr x,
int round)
Sets this to the Euclidean norm of x and y.
|
int |
intValue(int round)
Returns this as an integer (with rounding).
|
boolean |
isEqual(Mpfr op)
Whether this == op.
|
static boolean |
isERangeFlag()
Returns the erange (invalid range) flag.
|
boolean |
isGreater(Mpfr op)
Whether this > op.
|
boolean |
isGreaterEqual(Mpfr op)
Whether this >= op.
|
static boolean |
isInexFlag()
Returns the inexact flag.
|
boolean |
isInf()
Returns true if this is an infinity.
|
boolean |
isInteger()
Whether this is an integer.
|
boolean |
isLess(Mpfr op)
Whether this < op.
|
boolean |
isLessEqual(Mpfr op)
Whether this <= op.
|
boolean |
isLessGreater(Mpfr op)
Whether this < op or this > op.
|
boolean |
isNaN()
Returns true if this is a NaN.
|
static boolean |
isNaNFlag()
Returns the invalid flag.
|
boolean |
isNumber()
Returns true if this is a regular number (non-infinity or NaN).
|
static boolean |
isOverflow()
Returns the overflow flag.
|
boolean |
isPhysicalEqual(Mpfr x)
Whether this and x have the same address in memory.
|
static boolean |
isUnderflow()
Returns the underflow flag.
|
boolean |
isUnordered(Mpfr op)
Whether this or op is a NaN.
|
boolean |
isZero()
Returns true if this is +0 or -0.
|
int |
j0(Mpfr op,
int round)
Sets this to the value of the first kind Bessel function of order 0
at op.
|
int |
j1(Mpfr op,
int round)
Sets this to the value of the first kind Bessel function of order 1
at op.
|
int |
jn(int n,
Mpfr op,
int round)
Sets this to the value of the first kind Bessel function of order n
at op.
|
int |
lgamma(int[] sign,
Mpfr op,
int round)
Sets this to the logarithm of the absolute value of the Gamma
function at op.
|
int |
li2(Mpfr op,
int round)
Sets this to the real part of the dilogarithm of op.
|
int |
lngamma(Mpfr op,
int round)
Sets this to the logarithm of the value of the Gamma function at op.
|
int |
log(Mpfr op,
int round)
Sets this to the natural logarithm of op.
|
int |
log10(Mpfr op,
int round)
Sets this to the logarithm in base 10 of op.
|
int |
log1p(Mpfr op,
int round)
Sets this to log(1+op).
|
int |
log2(Mpfr op,
int round)
Sets this to the logarithm in base 2 of op.
|
int |
max(Mpfr op1,
Mpfr op2,
int round)
Sets this to the maximum of op1 and op2.
|
int |
min(Mpfr op1,
Mpfr op2,
int round)
Sets this to the minimum of op1 and op2.
|
int |
modf(Mpfr f,
Mpfr op,
int round)
Sets this to the integral part of op, and f to its fractional part.
|
int |
MpzExponentValue(Mpz r)
Converts exactly this to the form v*2^e, where v is an integer.
|
Mpz |
MpzValue(int round)
Converts this to an integer (with rounding) and returns it.
|
int |
mul(double op,
int round)
Multiplies op by this.
|
int |
mul(int op,
int round)
Multiplies op by this.
|
int |
mul(Mpfr op1,
double op2,
int round)
Sets this to op1*op2.
|
int |
mul(Mpfr op,
int round)
Multiplies op by this.
|
int |
mul(Mpfr op1,
int op2,
int round)
Sets this to op1*op2.
|
int |
mul(Mpfr op1,
Mpfr op2,
int round)
Sets this to op1*op2.
|
int |
mul(Mpfr op1,
Mpq op2,
int round)
Sets this to op1*op2.
|
int |
mul(Mpfr op1,
Mpz op2,
int round)
Sets this to op1*op2.
|
int |
mul(Mpq op,
int round)
Multiplies op by this.
|
int |
mul(Mpz op,
int round)
Multiplies op by this.
|
int |
mul2exp(int op,
int round)
Multiplies this by 2^op.
|
int |
mul2exp(Mpfr op1,
int op2,
int round)
Sets this to op1*(2^op2).
|
int |
neg(int round)
Negates this.
|
int |
neg(Mpfr op,
int round)
Sets this to -op.
|
void |
nextAbove()
Sets this to the representable float following x.
|
void |
nextBelow()
Sets this to the representable float preceding x.
|
void |
nextToward(Mpfr op)
Sets this to the next representable float following x
in the direction of y.
|
int |
pow(Mpfr op1,
int op2,
int round)
Stores op1^op2 into this.
|
int |
pow(Mpfr op1,
Mpfr op2,
int round)
Stores op1^op2 into this.
|
int |
pow(Mpfr op1,
Mpz op2,
int round)
Stores op1^op2 into this.
|
int |
precRound(int prec,
int round)
Rounds this to prec bits and changes its precision.
|
int |
random(RandState r)
Stores into this a uniformly distributed random number in [0, 1].
|
int |
recSqrt(int round)
Takes the inverted square root of this.
|
int |
recSqrt(Mpfr op,
int round)
Sets this to the inverted square root of op.
|
int |
remainder(Mpfr x,
Mpfr y,
int round)
Sets this to x-y*round(x/y).
|
int |
remquo(int[] q,
Mpfr x,
Mpfr y,
int round)
Sets this to x-y*round(x/y).
|
int |
rint_ceil(Mpfr op,
int round)
Stores into this, the integer following op, then rounded.
|
int |
rint_floor(Mpfr op,
int round)
Stores into this, the integer preceding op, then rounded.
|
int |
rint_round(Mpfr op,
int round)
Stores into this, the integer nearest op, then rounded.
|
int |
rint_trunc(Mpfr op,
int round)
Stores into this, op truncated to an integer, then rounded.
|
int |
rint(Mpfr op,
int round)
Stores into this, op rounded to the nearest representable
integer for the given rounding mode.
|
int |
root(int k,
int round)
Takes the k-th root of this.
|
int |
root(Mpfr op,
int k,
int round)
Sets this to the k-th root of op.
|
int |
round(Mpfr op)
Stores into this, op rounded to the nearest representable integer.
|
int |
sec(Mpfr op,
int round)
Sets this to the secant of op.
|
int |
sech(Mpfr op,
int round)
Sets this to the hyperbolic secant of op.
|
int |
set(java.math.BigInteger v,
int round)
Sets this to an integer (with rounding).
|
int |
set(double v,
int round)
Sets this to a double (with rounding).
|
int |
set(int v,
int round)
Sets this to an integer (with rounding).
|
int |
set(int v,
int e,
int round)
Sets this to a v*2^e (with rounding).
|
void |
set(Mpfr v)
Copies v into this, changing the precision of this to match that of v.
|
int |
set(Mpfr v,
int round)
Copies v into this (with rounding).
|
int |
set(Mpq v,
int round)
Sets this to a fraction (with rounding).
|
int |
set(Mpz v,
int round)
Sets this to an integer (with rounding).
|
void |
set(java.lang.String s,
int round)
Sets this to the number represented in the decimal String s
(with rounding).
|
void |
set(java.lang.String s,
int b,
int round)
Sets this to the number represented in the String s in base b
(with rounding).
|
static void |
setDefaultPrec(int prec)
Sets the default precision to exactly prec bits.
|
static boolean |
setEmax(long exp)
Sets the current largest exponent allowed for a for a floating-point
variable.
|
static boolean |
setEmin(long exp)
Sets the current smallest exponent allowed for a for a floating-point
variable.
|
static void |
setERangeFlag()
Sets the erange (invalid range) flag.
|
boolean |
setExp(int e)
Sets the exponent of this to e.
|
static void |
setInexFlag()
Sets the inexact flag.
|
void |
setInf(int sign)
Sets this to a signed infinity.
|
void |
setNaN()
Sets this to NaN.
|
static void |
setNaNFlag()
Sets the invalid flag.
|
static void |
setOverflow()
Sets the overflow flag.
|
void |
setPrec(int prec)
Changes the precision of this to exactly prec bits.
|
int |
setSign(Mpfr op,
boolean s,
int round)
Sets this to op (rounded) and then sets the bit-sign of this to s.
|
static void |
setUnderflow()
Sets the underflow flag.
|
int |
sgn()
Returns a positive value if this is positive, negative if this is
negative, and null if this is zero or NaN.
|
boolean |
signBit()
Returns true if this has its sign bit set.
|
int |
sin(Mpfr op,
int round)
Sets this to the sine of op.
|
int |
sinCos(Mpfr c,
Mpfr op,
int round)
Sets this to the sine of op, and c to its cosine.
|
int |
sinh(Mpfr op,
int round)
Sets this to the hyperbolic sine of op.
|
int |
sinhCosh(Mpfr c,
Mpfr op,
int round)
Sets this to the hyperbolic sine of op, and c to its hyperbolic cosine.
|
int |
sqrt(int round)
Takes the square root of this.
|
int |
sqrt(int op,
int round)
Sets this to the square root of op.
|
int |
sqrt(Mpfr op,
int round)
Sets this to the square root of op.
|
int |
sub(double op,
int round)
Subtracts op from this.
|
int |
sub(double op1,
Mpfr op2,
int round)
Sets this to op1-op2.
|
int |
sub(int op,
int round)
Subtracts op from this.
|
int |
sub(int op1,
Mpfr op2,
int round)
Sets this to op1-op2.
|
int |
sub(Mpfr op1,
double op2,
int round)
Sets this to op1-op2.
|
int |
sub(Mpfr op,
int round)
Subtracts op from this.
|
int |
sub(Mpfr op1,
int op2,
int round)
Sets this to op1-op2.
|
int |
sub(Mpfr op1,
Mpfr op2,
int round)
Sets this to op1-op2.
|
int |
sub(Mpfr op1,
Mpq op2,
int round)
Sets this to op1-op2.
|
int |
sub(Mpfr op1,
Mpz op2,
int round)
Sets this to op1-op2.
|
int |
sub(Mpq op,
int round)
Subtracts op from this.
|
int |
sub(Mpz op,
int round)
Subtracts op from this.
|
int |
subNormalize(int t,
int round)
Rounds this to emulate subnormal arithmetic.
|
int |
subRev(double op,
int round)
Stores op-this into this.
|
int |
subRev(int op,
int round)
Stores op-this into this.
|
int |
sum(Mpfr[] ar,
int round)
Stores into this the sum of an array or Mpfr (correctly rounded).
|
int |
tan(Mpfr op,
int round)
Sets this to the tangent of op.
|
java.lang.String |
toString()
Returns a String representation of this in base 10
(rounding to nearest).
|
java.lang.String |
toString(int b,
int n,
int round)
Returns a String representation (with rounding).
|
static java.lang.String |
toStringRndMode(int round)
Returns the name of the rounding mode.
|
int |
trunc(Mpfr op)
Stores into this, op truncated to a representable integer.
|
int |
y0(Mpfr op,
int round)
Sets this to the value of the second kind Bessel function of order 0
at op.
|
int |
y1(Mpfr op,
int round)
Sets this to the value of the second kind Bessel function of order 1
at op.
|
int |
yn(int n,
Mpfr op,
int round)
Sets this to the value of the second kind Bessel function of order n
at op.
|
int |
zeta(int op,
int round)
Sets this to the value of the Riemann Zeta function at op.
|
int |
zeta(Mpfr op,
int round)
Sets this to the value of the Riemann Zeta function at op.
|
public static final int RNDN
public static final int RNDZ
public static final int RNDU
public static final int RNDD
public Mpfr()
It is set to NaN.
public Mpfr(int prec)
It is set to NaN.
public Mpfr(Mpfr v)
public Mpfr(Mpfr v, int round)
public Mpfr(int v, int round)
public Mpfr(java.math.BigInteger v, int round)
public Mpfr(Mpz v, int round)
public Mpfr(double v, int round)
public Mpfr(Mpq v, int round)
public Mpfr(java.lang.String s, int b, int round)
public Mpfr(java.lang.String s, int round)
protected void finalize()
finalize
in class java.lang.Object
public Mpfr clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public static void setDefaultPrec(int prec)
This only affects objects created after the call.
The default is 53 bits initially (i.e., same as double precision IEEE floats).
public static int getDefaultPrec()
public void setPrec(int prec)
The value of this is lost and set to NaN.
public int getPrec()
public int set(Mpfr v, int round)
public void set(Mpfr v)
public int set(int v, int round)
public int set(int v, int e, int round)
public int set(java.math.BigInteger v, int round)
public int set(Mpz v, int round)
public int set(double v, int round)
public int set(Mpq v, int round)
public void set(java.lang.String s, int b, int round)
public void set(java.lang.String s, int round)
public void setInf(int sign)
public void setNaN()
public int intValue(int round)
fitsInt(int)
public double doubleValue(int round)
public double doubleExponentValue(int[] r, int round)
The mantissa m returned is such that 0.5 <= |m| < 1, rounded to fit double.
The exponent is stored into r[0].
public Mpz MpzValue(int round)
public int MpzExponentValue(Mpz r)
v is stored into r while e is returned.
public java.lang.String toString(int b, int n, int round)
b is the base, between 2 and 62.
n is the number of digits to output, or 0 to denote sufficient precision so that it is possible to recover the original value when parsing using rounding to nearest.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean fitsInt(int round)
public int add(Mpfr op1, int op2, int round)
public int add(Mpfr op1, double op2, int round)
public int add(Mpfr op, int round)
public int add(int op, int round)
public int add(double op, int round)
public int add(Mpz op, int round)
public int add(Mpq op, int round)
public int sub(Mpfr op1, int op2, int round)
public int sub(Mpfr op1, double op2, int round)
public int sub(int op1, Mpfr op2, int round)
public int sub(double op1, Mpfr op2, int round)
public int sub(Mpfr op, int round)
public int sub(int op, int round)
public int sub(double op, int round)
public int sub(Mpz op, int round)
public int sub(Mpq op, int round)
public int subRev(int op, int round)
public int subRev(double op, int round)
public int mul(Mpfr op1, int op2, int round)
public int mul(Mpfr op1, double op2, int round)
public int mul(Mpfr op, int round)
public int mul(int op, int round)
public int mul(double op, int round)
public int mul(Mpz op, int round)
public int mul(Mpq op, int round)
public int div(Mpfr op1, int op2, int round)
public int div(Mpfr op1, double op2, int round)
public int div(int op1, Mpfr op2, int round)
public int div(double op1, Mpfr op2, int round)
public int div(Mpfr op, int round)
public int div(int op, int round)
public int div(double op, int round)
public int div(Mpz op, int round)
public int div(Mpq op, int round)
public int divRev(int op, int round)
public int divRev(double op, int round)
public int sqrt(Mpfr op, int round)
public int sqrt(int round)
public int sqrt(int op, int round)
public int recSqrt(Mpfr op, int round)
public int recSqrt(int round)
public int cbrt(Mpfr op, int round)
public int cbrt(int round)
public int root(Mpfr op, int k, int round)
k must be positive.
public int root(int k, int round)
k must be positive.
public int pow(Mpfr op1, int op2, int round)
public int neg(Mpfr op, int round)
public int neg(int round)
public int abs(Mpfr op, int round)
public int abs(int round)
public int mul2exp(Mpfr op1, int op2, int round)
public int mul2exp(int op, int round)
public int div2exp(Mpfr op1, int op2, int round)
public int div2exp(int op, int round)
public int cmp(Mpfr op)
Returns a strictly positive, null, or negative number when this is respectively strictly greater, equal, or strictly smalled than op.
A NaN causes erange to be set and 0 to be returned.
public int cmp(int op)
Returns a strictly positive, null, or negative number when this is respectively strictly greater, equal, or strictly smalled than op.
A NaN causes erange to be set and 0 to be returned.
public int cmp(double op)
Returns a strictly positive, null, or negative number when this is respectively strictly greater, equal, or strictly smalled than op.
A NaN causes erange to be set and 0 to be returned.
public int cmp(Mpz op)
Returns a strictly positive, null, or negative number when this is respectively strictly greater, equal, or strictly smalled than op.
A NaN causes erange to be set and 0 to be returned.
public int cmp(Mpq op)
Returns a strictly positive, null, or negative number when this is respectively strictly greater, equal, or strictly smalled than op.
A NaN causes erange to be set and 0 to be returned.
public int cmp2exp(int op, int e)
Returns a strictly positive, null, or negative number when this is respectively strictly greater, equal, or strictly smalled than op*2^e.
A NaN causes erange to be set and 0 to be returned.
public int cmpAbs(Mpfr op)
public boolean isNaN()
public boolean isInf()
public boolean isNumber()
public boolean isZero()
public int sgn()
public boolean isGreater(Mpfr op)
false if any operand is NaN.
public boolean isGreaterEqual(Mpfr op)
false if any operand is NaN.
public boolean isLess(Mpfr op)
false if any operand is NaN.
public boolean isLessEqual(Mpfr op)
false if any operand is NaN.
public boolean isLessGreater(Mpfr op)
false if any operand is NaN.
public boolean isEqual(Mpfr op)
false if any operand is NaN: we have NaN!=NaN.
public boolean isUnordered(Mpfr op)
public boolean equals(java.lang.Object x)
This compares representations, and so, NaN is assumed equal to
NaN (unlike isEqual(gmp.Mpfr)
that follows the IEEE 754 convention).
equals
in class java.lang.Object
public int compareTo(Mpfr x)
compareTo
in interface java.lang.Comparable<Mpfr>
equals(Object)
public int hashCode()
hashCode
in class java.lang.Object
public boolean isPhysicalEqual(Mpfr x)
public int log(Mpfr op, int round)
public int log2(Mpfr op, int round)
public int log10(Mpfr op, int round)
public int exp(Mpfr op, int round)
public int exp2(Mpfr op, int round)
public int exp10(Mpfr op, int round)
public int cos(Mpfr op, int round)
public int sin(Mpfr op, int round)
public int tan(Mpfr op, int round)
public int sec(Mpfr op, int round)
public int csc(Mpfr op, int round)
public int cot(Mpfr op, int round)
public int sinCos(Mpfr c, Mpfr op, int round)
public int acos(Mpfr op, int round)
public int asin(Mpfr op, int round)
public int atan(Mpfr op, int round)
public int cosh(Mpfr op, int round)
public int sinh(Mpfr op, int round)
public int sinhCosh(Mpfr c, Mpfr op, int round)
public int sech(Mpfr op, int round)
public int csch(Mpfr op, int round)
public int coth(Mpfr op, int round)
public int acosh(Mpfr op, int round)
public int asinh(Mpfr op, int round)
public int atanh(Mpfr op, int round)
public int fac(int i, int round)
i must be positive.
public int log1p(Mpfr op, int round)
public int expm1(Mpfr op, int round)
public int eint(Mpfr op, int round)
public int li2(Mpfr op, int round)
public int gamma(Mpfr op, int round)
public int lngamma(Mpfr op, int round)
public int lgamma(int[] sign, Mpfr op, int round)
Also stores the sign of the value into sign[0].
public int zeta(Mpfr op, int round)
public int zeta(int op, int round)
op must be positive.
public int erf(Mpfr op, int round)
public int erfc(Mpfr op, int round)
public int j0(Mpfr op, int round)
public int j1(Mpfr op, int round)
public int jn(int n, Mpfr op, int round)
public int y0(Mpfr op, int round)
public int y1(Mpfr op, int round)
public int yn(int n, Mpfr op, int round)
public int agm(Mpfr op1, Mpfr op2, int round)
public int constLog2(int round)
public int constPi(int round)
public int constEuler(int round)
public int constCatalan(int round)
public static void freeCache()
public int sum(Mpfr[] ar, int round)
public int rint(Mpfr op, int round)
public int ceil(Mpfr op)
public int floor(Mpfr op)
public int round(Mpfr op)
public int trunc(Mpfr op)
public int rint_ceil(Mpfr op, int round)
public int rint_floor(Mpfr op, int round)
public int rint_round(Mpfr op, int round)
public int rint_trunc(Mpfr op, int round)
public int frac(Mpfr op, int round)
public int modf(Mpfr f, Mpfr op, int round)
public int remquo(int[] q, Mpfr x, Mpfr y, int round)
Stores into q[0] the low bits of the (signed) quotient round(x/y).
public boolean isInteger()
public int precRound(int prec, int round)
public boolean canRound(int err, int round1, int round2, int prec)
Assuming that this approximates some number x in the direction round1 with error at most 2^(expb-err), where expb is the exponent of b, returns true if x can be correctly rounded to prec bits in the direction round2. Does not modify this.
public static java.lang.String toStringRndMode(int round)
public void nextToward(Mpfr op)
public void nextAbove()
public void nextBelow()
public int getExp()
public boolean setExp(int e)
public boolean signBit()
public int setSign(Mpfr op, boolean s, int round)
public int copySign(Mpfr op1, Mpfr op2, int round)
public static java.lang.String getVersion()
public static java.lang.String getPatches()
public static long getEmin()
public static long getEmax()
public static boolean setEmin(long exp)
Returns true if the change was successful.
public static boolean setEmax(long exp)
Returns true if the change was successful.
public static long getEminMin()
setEmin(long)
.public static long getEminMax()
setEmin(long)
.public static long getEmaxMin()
setEmax(long)
.public static long getEmaxMax()
setEmax(long)
.public int checkRange(int t, int round)
public int subNormalize(int t, int round)
public static void clearUnderflow()
public static void clearOverflow()
public static void clearNaNFlag()
public static void clearInexFlag()
public static void clearERangeFlag()
public static void setUnderflow()
public static void setOverflow()
public static void setNaNFlag()
public static void setInexFlag()
public static void setERangeFlag()
public static boolean isUnderflow()
public static boolean isOverflow()
public static boolean isNaNFlag()
public static boolean isInexFlag()
public static boolean isERangeFlag()
public int random(RandState r)