Curriculum
Course: Java Basic
Login

Curriculum

Java Basic

Java Home

0/1

Java Introduction

0/1

Java Get Started

0/1

Java Syntax

0/1

Java Comments

0/1

Java Type Casting

0/1

Java Operators

0/1

Java Booleans

0/1

Java Switch

0/1

Java Break / Continue

0/1

Java Errors and Exception

0/1
Text lesson

scalb()

Example

Return numbers multiplied by multiples of 2.

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 yields the outcome of the expression x times 2 raised to the power of y, where x is a floating-point number and y is an integer.

Syntax

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

“Necessary. The value to be multiplied by a power of 2.”

y

“Necessary. The exponent for the base of 2.”

Technical Details

Returns:

A numerical value, either a double or float, representing the outcome of the expression x⋅2yx \cdot 2^y.

Java version:

1.6+