mpc: Arbitrarily High Precision Complex Number Arithmetic

Description Usage Arguments Details Value References See Also Examples

Description

A class for arbitrarily high precision complex number arithmetic.

Usage

1
mpc(z, precision=NULL)

Arguments

z

A numeric value representing the real part of a complex number, or a complex value.

precision

The number of bits of precision that should be used to represent z.

Details

If the precision argument is NULL then the contents of the mpc.precision option will be used instead.

MPC supports 16 possible rounding modes for complex arithmetic which are specified through the mpc.rounding option. The default rounding option, MPC_RNDNN, rounds both the real and imaginary parts to the nearest representable number as specified in the IEEE Floating Point standard.

A complex rounding mode is of the form MPC_RNDxy where x and y are one of N (to nearest), Z (towards zero), U (towards plus infinity), D (towards minus infinity). The first letter refers to the rounding mode for the real part, and the second one for the imaginary part. For example MPC_RNDZU indicates to round the real part towards zero, and the imaginary part towards plus infinity.

Value

An object of (S3) class mpc, which the user should use as a normal numeric value. Currently, the implementation does not support use as a numeric vector.

References

Andeas Enge, Micka\"el Gastineau, Philippe Th\'eveny, and Paul Zimmermann, mpc — A library for multiprecision complex arithmetic with exact rounding, see http://www.multiprecision.org.

See Also

complex.

Examples

1
2
3
4
5
6
library(mpc)

summary(mpc(3,100) / mpc (3,100))

options("mpc.rounding" = "MPC_RNDUU")
summary(mpc(3,3) / mpc(3.01,3))

mpc documentation built on May 2, 2019, 5:25 p.m.