JavaScript fround() Method

Definition and Usage

fround() The method returns the nearest (32-bit single-precision) floating-point representation of a number.

Example

Round different numbers to the nearest (32-bit single-precision) floating-point representation:

var a = Math.fround(2.60);
var b = Math.fround(2.50);
var c = Math.fround(2.49);
var d = Math.fround(-2.60);
var e = Math.fround(-2.50);
var f = Math.fround(-2.49);

Try It Yourself

Syntax

Math.fround(x)

Parameter Value

Parameter Description
x Required. Number.

Technical Details

Return value: Returns the nearest 32-bit single-precision floating-point representation of a number.
JavaScript Version: ECMAScript 2015

Browser Support

Method Chrome Edge Firefox Safari Opera
fround() 38.0 26.0 12.0 8.0 25.0

Related Pages

Tutorial:JavaScript Mathematics