Learn R Programming

DPQmpfr (version 0.3-3)

DPQmpfr-utils: Numeric / Mpfr Utilities for DPQmpfr

Description

Utilities for package DPQmpfr

Usage

ldexp(f, E)

Value

either a numeric or a "mpfr", depending on the type of

f, vector as (the recyled) combination of f and E.

Arguments

f

‘fraction’, as such with absolute value in \([0.5, 1)\), but can be any numbers.

E

integer-valued exponent(s).

Details

ldexp() is a simple wrapper, either calling DPQ::ldexp from DPQ or ldexpMpfr from the Rmpfr package, $$ ldexp(f, E) := f \times 2^E,$$ computed accurately and fast on typical platforms with internally binary arithmetic.

See Also

ldexp from package DPQ and ldexpMpfr from package Rmpfr.

Examples

Run this code
ldexp(1:10, 2)
ldexp(Rmpfr::Const("pi", 96), -2:2) # =  pi * (1/4  1/2  1  2  4)

Run the code above in your browser using DataLab