Decodes each IEEE 754 double to its exact decimal value, then quantizes that
value to the requested scale. This differs from parsing a character literal
such as "0.1". Because the exact binary value of a double can require
dozens of fractional digits, a scale must be given explicitly or configured
with options(decimal.default_scale = ). Quantization uses the active
context's rounding and trap settings.
Examples
decimal_from_double(0.1, scale = 20)
#> <decimal[1]>
#> [1] 0.10000000000000000555
decimal_from_double(c(0.5, 0.25), scale = 2)
#> <decimal[2]>
#> [1] 0.50 0.25