Click or drag to resize
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)
Syntax
public static float scalbln(
	float number,
	long exponent
)

Parameters

number
Type: SystemSingle
A floating-point number.
exponent
Type: SystemInt64
The exponent of the power of two.

Return Value

Type: Single
The 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.

Examples
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);
See Also