What is Math.ScaleB() in C#?

C# has a built-in Math class which provides useful mathematical functions and operations. The class has the ScaleB() function, which is used to compute _base * (2 ^ _power).

Syntax

public static double ScaleB (double _base, int _power);

Parameters

  • _base: This is a double-precision floating-point number that specifies the base value for finding ScaleB().
  • _power: This is a 32-bit integer that specifies the power for finding ScaleB().

Return value

  • Double: This value returns a Double number found by computing _base * (2 ^ _power).

Example

using System;
class Educative
{
static void Main()
{
double result = Math.ScaleB(3, 2);
System.Console.WriteLine("ScaleB(3, 2) = "+ result);
double result1 = Math.ScaleB(2.55, 4);
System.Console.WriteLine("ScaleB(2.55, 4) = "+ result1);
}
}
Output
  • ScaleB ( 3 , 2 ) = 12
  • ScaleB ( 2.55 , 4 ) = 40.8

Free Resources