signifz | R Documentation |
Rounds the value to a specified number of significant digits, using IEEE 754 rounding towards zero rounding mode.
signifz(x, digits = 6)
x |
A numeric vector. |
digits |
An integer indicating the precision to be used. |
This function rounds the values in its first argument to the specified number of significant digits, using IEC 60559/IEEE 754 “round towards zero” mode. This is an alternative to the round
function, which rounds toward nearest, ties to even. This is designed to be used internally by unf3
and unf4
(though the original implementations do not seem to actually use the function). unf5
uses round
instead.
Rounding toward zero assures that signifz(signifz(x,digits=m),digits=n)
= signifz(x,digits=n)
for $m>n$, an important property for creating approximate fingerprints. It can, however, produce more rounding error than rounding toward nearest. The maximum log relative error (LRE) for the former is (digits-1) while the maximum LRE for the latter is ‘digits’. Hence, you may wish to use one more significant digit with signifz
than with signif
.
Micah Altman
signif
, unf
# note the difference signif(pi,digits=5) signifz(pi,digits=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.