DecFP.Dec128Type
Dec128(x::Union{Real, AbstractString} [, mode::RoundingMode])
Dec128([sign::Integer,] significand::Integer, exponent::Integer)

Create a 128-bit IEEE 754-2008 decimal floating point number. The mode argument specifies the direction in which the result should be rounded if the conversion cannot be done exactly. If not provided, the mode is set by the current rounding(DecFP.DecimalFloatingPoint) mode.

Dec128(x::Real) is the same as convert(Dec128, x).

Dec128(x::AbstractString) is the same as parse(Dec128, x). This is provided for convenience since decimal literals are converted to Float64 when parsed and may not produce what you expect.

Dec128(sign, significand, exponent) returns sign * significand * 10^exponent. If sign isn't passed, use the sign of significand.

Examples

julia> Dec128(1)
1.0

julia> Dec128(1.5)
1.5

julia> Dec128("0.99999999999999999999999999999999999")
1.0

julia> Dec128("0.99999999999999999999999999999999999", RoundDown)
0.9999999999999999999999999999999999

julia> Dec128(-1, 123456, -4)
-12.3456
DecFP.Dec32Type
Dec32(x::Union{Real, AbstractString} [, mode::RoundingMode])
Dec32([sign::Integer,] significand::Integer, exponent::Integer)

Create a 32-bit IEEE 754-2008 decimal floating point number. The mode argument specifies the direction in which the result should be rounded if the conversion cannot be done exactly. If not provided, the mode is set by the current rounding(DecFP.DecimalFloatingPoint) mode.

Dec32(x::Real) is the same as convert(Dec32, x).

Dec32(x::AbstractString) is the same as parse(Dec32, x). This is provided for convenience since decimal literals are converted to Float64 when parsed and may not produce what you expect.

Dec32(sign, significand, exponent) returns sign * significand * 10^exponent. If sign isn't passed, use the sign of significand.

Examples

julia> Dec32(1)
1.0

julia> Dec32(1.5)
1.5

julia> Dec32("0.99999999999999999999999999999999999")
1.0

julia> Dec32("0.99999999999999999999999999999999999", RoundDown)
0.9999999

julia> Dec32(-1, 123456, -4)
-12.3456
DecFP.Dec64Type
Dec64(x::Union{Real, AbstractString} [, mode::RoundingMode])
Dec64([sign::Integer,] significand::Integer, exponent::Integer)

Create a 64-bit IEEE 754-2008 decimal floating point number. The mode argument specifies the direction in which the result should be rounded if the conversion cannot be done exactly. If not provided, the mode is set by the current rounding(DecFP.DecimalFloatingPoint) mode.

Dec64(x::Real) is the same as convert(Dec64, x).

Dec64(x::AbstractString) is the same as parse(Dec64, x). This is provided for convenience since decimal literals are converted to Float64 when parsed and may not produce what you expect.

Dec64(sign, significand, exponent) returns sign * significand * 10^exponent. If sign isn't passed, use the sign of significand.

Examples

julia> Dec64(1)
1.0

julia> Dec64(1.5)
1.5

julia> Dec64("0.99999999999999999999999999999999999")
1.0

julia> Dec64("0.99999999999999999999999999999999999", RoundDown)
0.9999999999999999

julia> Dec64(-1, 123456, -4)
-12.3456
DecFP.exponent10Method
exponent10(x::DecFP.DecimalFloatingPoint)

Get the exponent of the base 10 representation of a normalized floating-point number.

Examples

julia> exponent10(Dec64(123))
2
DecFP.ldexp10Method
ldexp10(x::DecFP.DecimalFloatingPoint, n::Integer)

Compute $x * 10^n$.

Examples

julia> ldexp10(Dec64(15), 2)
1500.0
DecFP.sigexpMethod
sigexp(x::DecFP.DecimalFloatingPoint)

Return (sign, significand, exponent) such that x is equal to sign * significand * 10^exponent. Throws DomainError for infinite or NaN arguments.

Examples

julia> sigexp(Dec64(1.25))
(1, 125, -2)