❮ Math Methods
Example
System.out.println(Math.scalb(1.5, 4));
System.out.println(Math.scalb(1.0, 5));
System.out.println(Math.scalb(1.2, 0));
System.out.println(Math.scalb(1.85, 10));Definition and Usage
The scalb() method returns the result of the formula x ·2 y for a floating point number x and an integer y .
One of the following
public static double scalb(double
x , int
y )public static float scalb(float
x , int
y )Parameter Values
| Parameter | Description |
|---|---|
| x | Required. The number to be multiplied by the power of 2. |
| y | Required. The exponent for the base 2. |
Technical Details
| Returns: | A double or float value representing the result of the formula x ·2 y . |
|---|---|
| Java version: | 1.6+ |