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

Parameters

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

Return Value

Type: Double
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(Double, Int64) is equivalent to ldexp(Double, Int32).

See scalbln in the C standard documentation.

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