NEWS | R Documentation |
Provide dummy C function in the case MPFR library is older than
3.2.0, thanks to Brian Ripley. Should work around check NOTE
s.
Formatting incl print()
ing by default uses a "+"
after the exponential character ("e"
by default).
Provide new low-level utilities .mpfr_formatinfo()
,
.mpfr2exp()
, and .mpfr_erange_is_int()
.
Renamed low-level utility functions to use _
instead of
.
keeping initial "."
, e.g.,
.mpfr.gmp.numbbits()
to .mpfr_gmp_numbbits()
.
formatMpfr()
gets a new optional decimal.plus = TRUE
which
adds a "+"
before positive exponents when in exponential (aka
“scientific”) representation.
The mpfr
and mpfrArray
print()
methods get
a corresponding decimal.plus
argument with a default that can
be set by options(Rmpfr.print.decimal.plus = *)
to allow
strict back compatibility where needed.
For MPFR (C library) version >= 3.2.0 (not by default in Fedora 30!),
provide the incomplete gamma function igamma(a,x)
which is closely related to pgamma(x,a)
, see help page.
Now also export S3 method of unique()
for "mpfr"
,
such that base factor(<mpfr>)
“works”.
formatMpfr()
and hence all print()
ing suffered
from an integer overflow bug with very large (base 2) exponents.
.mpfr2str(x, *)
is no longer dependent on the
order of the elements in x
; consequently
format()
and print()
may use less digits in case the
precision decreases along x
.
adapt to new C compiler default behavior -fno-common
,
using extern #include <Syms.h>
in most ‘*.c’ files.
Decreased the default for max.digits
to 999.
Provide dgamma(x, shape)
version, e.g., for small shape
parameter where most of the mass is on very small x
not
representable as double precision numbers.
Low-level formatting function .mpfr2str()
— called by
format()
and hence print()
methods for "mpfr"
objects — now finally obeys its maybe.full
argument when it
is FALSE
, internally in C's mpfr2str()
.
pnorm(<large>, log.p=TRUE)
no longer underflows much too
early, thanks to reports by Jerry Lewis.
print.mpfrArray()
now also uses a finite
max.digits
default, preventing, e.g., cbind(x, y)
to
use too many digits.
str(<mpfr>)
no longer calls formatMpfr(x, digits, *)
with a digits
vector of the same length as x
(which never worked correctly).
seqMpfr(1, length.out=8)
now works correctly.
unirootR()
gets an option to not warn on
non-convergence.
Provide a summary()
method for "mpfr"
numbers
closely modeled after summary.default
for numeric.
mpfr(NULL)
now works, returning mpfr(logical())
.
a simple sapplyMpfr()
function, showing how to work
around the fact that sapply()
does typically not work with
"mpfr"
numbers.
formatMpfr()
for large low-precision numbers now uses
scientific representation, fixing the bug RMH was reporting March
17 already.
outer()
is “imported” from base, so it
behaves as an Rmpfr function which dispatches e.g., when
calling tcrossprod()
.
.mpfr2list()
and mpfrXport()
gain an option
names
(for nicer output).
formatMpfr()
and the print()
method get a new
option max.digits
with default 9999
for the print
methods, to limit the number of digits printed for high precision
numbers.
For non-“regular” mpfr numbers, the d
slot in
the "mpfr1"
representation is now empty instead of
“random”. This also eliminates valgrind warnings about
uninitialized values in C.
The S3 classes "Hcharacter"
and "Bcharacter"
resulting from formatHex()
and formatBin()
now
“inherit from” "character"
formally.
They also got a `[`
method, so subsetting should
work, including for array
s of these.
The "mpfr"
method of str()
gains option
internal
.
when print()
ing mpfr numbers, the result no longer sometimes
loses the last digit.
dnorm()
now works correctly with mpfr numbers;
similarly dbinom()
and dpois()
should work in all
cases, now.
in ‘NAMESPACE’, also exportMethods(apply)
, so
SNscan works.
print(formatHex(..))
, formatBin()
and
formatDec()
now look better and are more correct; the first
two get a new option expAlign
indicating to use the same
number of digits for exponents (in “scientific” cases).
Notably, mpfr(formatBin(mpx))
works for more mpx
objects (of class "mpfr"
).
format(mpfr(3,7), digits = 1, base = 2)
no longer
crashes (from inside MPFR).
formatDec(mpfr(NA, 7))
now works.
For non-“regular” mpfr numbers, the d
slot in
the "mpfr1"
representation is now empty instead of
“random”. This also eliminates valgrind warnings about
uninitialized values in C.
head()
and tail()
methods for "mpfrMatrix"
.
C-level mpfr2str()
no longer calls S_realloc() with
wrong "old size" (thanks to Bill Dunlap).
c()
now also works when its result is a length-0
"mpfr"
object.
mpfr()
now is S3 generic with several methods, notably a
"mpfr"
method allowing to change precision or rounding mode.
mpfr()
, formatMpfr()
, etc, now work with bases from 2
to 62 (using digits, upper and lower case ASCII letters, 62
== 10 + 2*26
characters), as this has been in MPFR since version
3.0.0 (see mpfrVersion
), which is hence (implicitly)
required for base
greater than 36.
formatMpfr()
gets a new argument base = 10
and can
be used to produce in other bases, notably binary (base = 2
)
or hexadecimal (base = 16
).
str(<mpfr>, ....)
is now based on formatMpfr()
and nicely shows numbers also out of the double precision range.
Further, it now chooses a smart default for optional argument
vec.len
.
matrix(mp, ..)
now also works when mp
is of
class "mpfr"
.
new matrix norm()
for several kind
s.
new functions formatHex()
and formatBin()
thanks to Rich Heiberger.
mpfr(x)
also works as inverse of
formatBin
and formatHex
.
roundMpfr()
and mathematical functions such as
jn
, or chooseMpfr()
get new optional argument
rnd.mode
passed to the corresponding MPFR function.
median(x)
, mean(x, trim)
for trim > 0
now work fine for "mpfr"
x, and quantile(x, *)
no
longer needs names=FALSE
to avoid a warning.
pnorm(.)
, j0()
and similar special functions
now preserve mpfrMatrix
and mpfrArray
classes.
similarly, is.finite()
etc keep the
dim()
ensionality for "mpfrArray"
arguments.
mpfr("0xabc", base=16)
and mpfr("0b101",
base=2)
and corresponding getPrec()
now give the correct
precBits instead of too many.
str(<0-length mpfr>)
now works correctly.
.
as.integer()
now rounds “to zero” as for
regular R numbers (it accidentally did round “to nearest”
previously).
experimental mpfrImport()
, mpfrXport()
utilities – as we found cases, where save() "mpfr"
objects
were not portable between different platforms.
as(*,"mpfr")
now also supports rounding mode
"A"
(“Away from zero”).
Several hidden low level utilities also get a
rnd.mode
option.
.
The result of integrateR()
now prints even if a
warning happened.
pbetaI(x, a,b)
, the arbitrarily accurate
pbeta()
computation for integer a and b,
now works for larger (a,b).
Newly providing mpfr
-versions of dbinom()
,
dpois()
, and dnorm()
.
New utility functions mpfr_default_prec()
,
.mpfr.minPrec()
, etc, to get, check, set default exponent
ranges and precision.
New sinpi()
, cospi()
etc, notably for R >= 3.0.1.
.
.