mathscalbln Method (Single, 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 float scalbln(
float number,
long exponent
)
Public Shared Function scalbln (
number As Single,
exponent As Long
) As Single
public:
static float scalbln(
float number,
long long exponent
)
static member scalbln :
number : float32 *
exponent : int64 -> float32
Parameters
- number
- Type: SystemSingle
A floating-point number. - exponent
- Type: SystemInt64
The exponent of the power of two.
Return Value
Type:
SingleThe 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(Single, Int64) is equivalent to ldexp(Single, Int32).
See scalbln in the C standard documentation.
ExamplesAssert.IsTrue(math.scalbln(0.8F, 4L) == 12.8F);
Assert.IsTrue(math.scalbln(-0.854375F, 5L) == -27.34F);
Assert.IsTrue(math.scalbln(1F, 0L) == 1F);
Assert.IsTrue(math.scalbln(math.FLT_MIN / 2F, 0L) == math.FLT_MIN / 2F);
Assert.IsTrue(math.scalbln(math.FLT_MIN / 2F, 1L) == math.FLT_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.5F, -math.FLT_MANT_BITS) == 2F * math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.5F, -math.FLT_MANT_BITS - 1) == math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.25F, -math.FLT_MANT_BITS) == math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.25F, -math.FLT_MANT_BITS - 1) == math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(1F, System.Int64.MaxValue) == System.Single.PositiveInfinity);
Assert.IsTrue(math.scalbln(1F, System.Int64.MinValue) == 0F);
Assert.IsTrue(math.scalbln(-1F, System.Int64.MaxValue) == System.Single.NegativeInfinity);
Assert.IsTrue(math.scalbln(-1F, System.Int64.MinValue) == -0F);
Assert.IsTrue(math.scalbln(0.8F, 4L) = 12.8F);
Assert.IsTrue(math.scalbln(-0.854375F, 5L) = -27.34F);
Assert.IsTrue(math.scalbln(1F, 0L) = 1F);
Assert.IsTrue(math.scalbln(math.FLT_MIN / 2F, 0L) = math.FLT_MIN / 2F);
Assert.IsTrue(math.scalbln(math.FLT_MIN / 2F, 1L) = math.FLT_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.5F, -math.FLT_MANT_BITS) = 2F * math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.5F, -math.FLT_MANT_BITS - 1) = math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.25F, -math.FLT_MANT_BITS) = math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(math.FLT_MIN * 1.25F, -math.FLT_MANT_BITS - 1) = math.FLT_DENORM_MIN);
Assert.IsTrue(math.scalbln(1F, System.Int64.MaxValue) = System.Single.PositiveInfinity);
Assert.IsTrue(math.scalbln(1F, System.Int64.MinValue) = 0F);
Assert.IsTrue(math.scalbln(-1F, System.Int64.MaxValue) = System.Single.NegativeInfinity);
Assert.IsTrue(math.scalbln(-1F, System.Int64.MinValue) = -0F);
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