Next: Input and Output Functions, Previous: Comparison Functions, Up: MPFR Interface
All those functions, except explicitly stated, return zero for an exact return value, a positive value for a return value larger than the exact result, and a negative value otherwise.
Set rop to the natural logarithm of op, log2(op) or log10(op), respectively, rounded in the direction rnd.
Set rop to the exponential of op, to 2 power of op or to 10 power of op, respectively, rounded in the direction rnd.
Set rop to the cosine of op, sine of op, tangent of op, rounded in the direction rnd.
Set rop to the secant of op, cosecant of op, cotangent of op, rounded in the direction rnd.
Set simultaneously sop to the sine of op and cop to the cosine of op, rounded in the direction rnd with the corresponding precisions of sop and cop. Return 0 iff both results are exact.
Set rop to the arc-cosine, arc-sine or arc-tangent of op, rounded in the direction rnd.
Set rop to the arc-tangent2 of y and x, rounded in the direction rnd: if
x > 0
,atan2(y, x) = atan (y/x)
; ifx < 0
,atan2(y, x) = sign(y)*(PI - atan (abs(y/x)))
.
atan2(y, 0)
does not raise any floating-point exception. Special values are currently handled as described in the ISO C99 standard for theatan2
function (note this may change in future versions):
atan2(+0, -0)
returns +Pi.atan2(-0, -0)
returns -Pi.atan2(+0, +0)
returns +0.atan2(-0, +0)
returns −0.atan2(+0, x)
returns +Pi for x < 0.atan2(-0, x)
returns -Pi for x < 0.atan2(+0, x)
returns +0 for x > 0.atan2(-0, x)
returns −0 for x > 0.atan2(y, 0)
returns -Pi/2 for y < 0.atan2(y, 0)
returns +Pi/2 for y > 0.atan2(+INF, -INF)
returns +3*Pi/4.atan2(-INF, -INF)
returns -3*Pi/4.atan2(+INF, +INF)
returns +Pi/4.atan2(-INF, +INF)
returns -Pi/4.atan2(+INF, x)
returns +Pi/2 for finite x.atan2(-INF, x)
returns -Pi/2 for finite x.atan2(y, -INF)
returns +Pi for finite y > 0.atan2(y, -INF)
returns -Pi for finite y < 0.atan2(y, +INF)
returns +0 for finite y > 0.atan2(y, +INF)
returns −0 for finite y < 0.
Set rop to the hyperbolic cosine, sine or tangent of op, rounded in the direction rnd.
Set rop to the hyperbolic secant of op, cosecant of op, cotangent of op, rounded in the direction rnd.
Set rop to the inverse hyperbolic cosine, sine or tangent of op, rounded in the direction rnd.
Set rop to the factorial of the
unsigned long int
op, rounded in the direction rnd.
Set rop to the logarithm of one plus op, rounded in the direction rnd.
Set rop to the exponential of op minus one, rounded in the direction rnd.
Set y to the exponential integral of x, rounded in the direction rnd. For positive x, the exponential integral is the sum of Euler's constant, of the logarithm of x, and of the sum for k from 1 to infinity of x to the power k, divided by k and factorial(k). For negative x, the returned value is NaN.
Set rop to the value of the Gamma function on op, rounded in the direction rnd. When op is a negative integer, NaN is returned.
Set rop to the value of the logarithm of the Gamma function on op, rounded in the direction rnd. When −2k−1 <= x <= −2k, k being a non-negative integer, NaN is returned. Note that on these negative values, this function is different from the corresponding function defined in some languages, such as
lgamma
in ISO C99; a new functionmpfr_lgamma
will be added in a future MPFR version to match this alternative definition.
Set rop to the value of the Riemann Zeta function on op, rounded in the direction rnd.
Set rop to the value of the error function on op, rounded in the direction rnd.
Set rop to the value of the complementary error function on op, rounded in the direction rnd.
Set rop to op1 times op2 + op3, rounded in the direction rnd.
Set rop to the arithmetic-geometric mean of op1 and op2, rounded in the direction rnd. The arithmetic-geometric mean is the common limit of the sequences u[n] and v[n], where u[0]=op1, v[0]=op2, u[n+1] is the arithmetic mean of u[n] and v[n], and v[n+1] is the geometric mean of u[n] and v[n]. If any operand is negative, the return value is NaN.
Set rop to the Euclidean norm of x and y, i.e. the square root of the sum of the squares of x and y, rounded in the direction rnd. Special values are currently handled as described in Section F.9.4.3 of the ISO C99 standard, for the
hypot
function (note this may change in future versions): If x or y is an infinity, then plus infinity is returned in rop, even if the other number is NaN.
Set rop to the logarithm of 2, the value of Pi, of Euler's constant 0.577..., of Catalan's constant 0.915..., respectively, rounded in the direction rnd. These functions cache the computed values to avoid other calculations if a lower or equal precision is requested. To free these caches, use
mpfr_free_cache
.
Free the cache used by the functions computing constants if needed (currently
mpfr_const_log2
,mpfr_const_pi
,mpfr_const_euler
andmpfr_const_catalan
).
Set ret to the sum of all elements of tab whose size is n, rounded in the direction rnd. Warning, tab is a table of pointers to mpfr_t, not a table of mpfr_t (preliminary interface). The returned
int
value is zero when the computed value is the exact value, and non-zero when this cannot be guaranteed, without giving the direction of the error as the other functions do.