JavaScript fround() method
- Forrige side floor()
- Næste side LN2
- Gå tilbage til forrige niveau JavaScript Math Reference Manual
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);
Syntax
Math.fround(x)
Parameter value
Parameter | Description |
---|---|
x | Required. Number. |
Technical details
Return value: | Return the nearest 32-bit single-precision floating-point representation of a number. |
---|---|
JavaScript version: | ECMAScript 2015 |
Browserunderstøttelse
Metoder | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
fround() | 38.0 | 26.0 | 12.0 | 8.0 | 25.0 |
Relaterede sider
Tutorial:JavaScript matematik
- Forrige side floor()
- Næste side LN2
- Gå tilbage til forrige niveau JavaScript Math Reference Manual