mathscalbln Method (Double, Int64) |
Scales the specified floating-point number by 2^exponent.
Namespace:
C
Assembly:
C.math (in C.math.dll) Version: 1.0.0.0 (1.0.0.0)
Syntaxpublic static double scalbln(
double number,
long exponent
)
Public Shared Function scalbln (
number As Double,
exponent As Long
) As Double
public:
static double scalbln(
double number,
long long exponent
)
static member scalbln :
number : float *
exponent : int64 -> float
Parameters
- number
- Type: SystemDouble
A floating-point number. - exponent
- Type: SystemInt64
The exponent of the power of two.
Return Value
Type:
DoubleThe value
number * 2^exponent.
Remarks
Special values are treated as follows.
- If number is ±0, it is returned.
- If number is infinite, it is returned.
- If exponent is 0, number is returned.
- If number is NaN, NaN is returned.
The function scalbln(Double, Int64) is equivalent to ldexp(Double, Int32).
See scalbln in the C standard documentation.
ExamplesAssert.IsTrue(math.scalbln(0.8D, 4L) == 12.8D);
Assert.IsTrue(math.scalbln(-0.854375D, 5L) == -27.34D);
Assert.IsTrue(math.scalbln(1D, 0L) == 1D);
Assert.IsTrue(math.scalbln(math.DBL_MIN / 2D, 0L) == math.DBL_MIN / 2D);
Assert.IsTrue(math.scalbln(math.DBL_MIN / 2D, 1L) == math.DBL_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.5D, -math.DBL_MANT_BITS) == 2D * math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.5D, -math.DBL_MANT_BITS - 1) == math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.25D, -math.DBL_MANT_BITS) == math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.25D, -math.DBL_MANT_BITS - 1) == math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(1D, System.Int64.MaxValue) == System.Double.PositiveInfinity);
Assert.IsTrue(math.scalbln(1D, System.Int64.MinValue) == 0D);
Assert.IsTrue(math.scalbln(-1D, System.Int64.MaxValue) == System.Double.NegativeInfinity);
Assert.IsTrue(math.scalbln(-1D, System.Int64.MinValue) == -0D);
Assert.IsTrue(math.scalbln(0.8D, 4L) = 12.8D);
Assert.IsTrue(math.scalbln(-0.854375D, 5L) = -27.34D);
Assert.IsTrue(math.scalbln(1D, 0L) = 1D);
Assert.IsTrue(math.scalbln(math.DBL_MIN / 2D, 0L) = math.DBL_MIN / 2D);
Assert.IsTrue(math.scalbln(math.DBL_MIN / 2D, 1L) = math.DBL_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.5D, -math.DBL_MANT_BITS) = 2D * math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.5D, -math.DBL_MANT_BITS - 1) = math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.25D, -math.DBL_MANT_BITS) = math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.DBL_MIN * 1.25D, -math.DBL_MANT_BITS - 1) = math.DBL_DENORM_MIN);
Assert.IsTrue(math.scalbln(1D, System.Int64.MaxValue) = System.Double.PositiveInfinity);
Assert.IsTrue(math.scalbln(1D, System.Int64.MinValue) = 0D);
Assert.IsTrue(math.scalbln(-1D, System.Int64.MaxValue) = System.Double.NegativeInfinity);
Assert.IsTrue(math.scalbln(-1D, System.Int64.MinValue) = -0D);
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also