Thursday, September 4, 2025
HomeLanguagesJavascriptJavaScript Math fround( ) Method

JavaScript Math fround( ) Method

The Javascript Math.fround() method is used to return the nearest 32-bit single-precision float representation of a number. The Math.fround() method in JavaScript is also used to cast the 64-bit float to a 32-bit float. 

Syntax:

Math.fround(value)

Parameters: This method accepts a single parameter value. This parameter represents the number for which we want to find the nearest 32-bit single-precision float representation. 

Return Value: The Math.fround() method returns the nearest 32-bit single-precision float representation of the given number. 

Below examples illustrates the Math.fround() method in JavaScript:

Example 1: When a positive number is passed as a parameter: 

Javascript




console.log(Math.fround(3));


Output

3

Example 2: When a positive number with decimal places is passed as a parameter: 

Javascript




console.log(Math.fround(3.345));


Output

3.3450000286102295

Example 3: When a negative number is passed as a parameter: 

Javascript




console.log(Math.fround(-3));


Output

-3

Example 4: When a negative number with decimal places is passed as a parameter: 

Javascript




console.log(Math.fround(-3.345));


Output

-3.3450000286102295

Example 5: When zero is passed as a parameter: 

Javascript




console.log(Math.fround(0));


Output

0

We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.

Supported Browsers:

The browsers supported by JavaScript Math.fround( ) method are listed below:

  • Google Chrome
  • Firefox
  • Opera
  • Safari
RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS