JavaScript fround() Method
Example
Round different numbers to the nearest (32-bit single precision) float representation of a number:
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 »
Definition and Usage
The fround() method returns the nearest (32-bit single precision) float
representation of a number.
Browser Support
Method |
|
|
|
|
|
fround() |
38.0 |
26.0 |
12.0 |
8.0 |
25.0 |
Syntax
Parameter Values
Parameter |
Description |
x |
Required. A number |
Technical Details
Return Value: |
Returns the nearest 32-bit single precision float representation of a
number |
JavaScript Version: |
ECMAScript 2015 |