Class arf
extends virtual class flint
. It
represents vectors of arbitrary precision floating-point real numbers.
Elements have arbitrary precision significand and exponent. The
underlying C type can represent NaN
, -Inf
,
and Inf
.
## The class generator function:
.arf(...)## Mode 1: initialize with zeros
## .arf(length = 0L)
##
## Mode 2: initialize with vector
## .arf(length = length(x), x)
The class generator function returns new("arf", ...)
.
arguments passed to methods for initialize
.
.xData
, names
inherited from virtual class flint
.
Due to constraints imposed by generic functions, methods typically do
not provide a formal argument prec
allowing for a
precision to be indicated in the function call. Such methods use the
current default precision set by flintPrec
.
!
signature(x = "arf")
:
equivalent to (but faster than) x == 0
.
+
signature(e1 = "arf", e2 = "missing")
:
returns a copy of the argument.
-
signature(e1 = "arf", e2 = "missing")
:
returns the negation of the argument.
Complex
signature(z = "arf")
:
mathematical functions of one argument; see
S4groupGeneric
.
Math
signature(x = "arf")
:
mathematical functions of one argument; see
S4groupGeneric
. Notably, the logarithmic,
exponential, (inverse) trigonometric, (inverse) hyperbolic, and
gamma-related member functions are not yet implemented. Users
wanting those can (for now) operate on
as(x, "arb")
.
Math2
signature(x = "arf")
:
decimal rounding according to a second argument digits
; see
S4groupGeneric
. There are just two member
member functions: round
, signif
.
Ops
signature(e1 = "ANY", e2 = "arf")
:
signature(e1 = "arf", e2 = "ANY")
:
binary arithmetic, comparison, and logical operators; see
S4groupGeneric
. The “other” operand
must be atomic or inherit from virtual class
flint
. The operands are recycled and
promoted as necessary.
Summary
signature(x = "arf")
:
univariate summary statistics; see
S4groupGeneric
. The return value is a
logical vector of length 1 (any
, all
) or an
arf
vector of length 1 or 2 (sum
, prod
,
min
, max
, range
).
anyNA
signature(x = "arf")
:
returns TRUE
if any element of x
is NaN
,
FALSE
otherwise.
as.vector
signature(x = "arf")
:
returns as.vector(y, mode)
, where y
is a double
vector containing the result of converting each element of
x
to the range of double, rounding if the value is not
exactly representable in double precision. The rounding mode is
to the nearest representable number (with precedence to even
significands in case of ties), unless the element exceeds
.Machine[["double.xmax"]]
in absolute value, in which case
-Inf
or Inf
is introduced with a warning. Coercion
to types "character"
, "symbol"
(synonym
"name"
), "pairlist"
, "list"
, and
"expression"
, which are not “number-like”, is
handled specially.
coerce
signature(from = "ANY", to = "arf")
:
returns .arf(x = from)
. An error is signaled if the class
or type of from
is not supported by the method for
initialize
.
format
signature(x = "arf")
:
returns a character vector suitable for printing, using scientific
format. Optional arguments control the output; see
format-methods
.
initialize
signature(.Object = "arf", length = "numeric")
:
returns .Object
after setting its .xData
slot. The
new slot value is an external pointer to an array of the
corresponding C type, which is newly allocated and
initialized entirely with zeros. .Object
is not copied, so
all references are affected.
initialize
signature(.Object = "arf", length = "numeric", x = "atomic|flint")
:
as above, except that the new slot value points to an array
initialized with values from x
.
is.finite
signature(x = "arf")
:
returns a logical vector indicating which elements of x
are not NaN
, -Inf
, or Inf
.
is.infinite
signature(x = "arf")
:
returns a logical vector indicating which elements of x
are -Inf
or Inf
.
is.na
, is.nan
signature(x = "arf")
:
returns a logical vector indicating which elements of x
are NaN
.
is.unsorted
signature(x = "arf")
:
returns a logical indicating if x
is not sorted in
nondecreasing order (increasing order if optional argument
strictly
is set to TRUE
).
mean
signature(x = "arf")
:
returns the arithmetic mean.
The FLINT documentation of the underlying C type: https://flintlib.org/doc/arf.html
Johansson, F. (2017). Arb: efficient arbitrary-precision midpoint-radius interval arithmetic. IEEE Transactions on Computers, 66(8), 1281-1292. tools:::Rd_expr_doi("10.1109/TC.2017.2690633")
Virtual class flint
.
showClass("arf")
showMethods(classes = "arf")
Run the code above in your browser using DataLab