Computer >> Computer tutorials >  >> Programming >> Javascript

Math. fround() function in JavaScript


The fround() function of the Math object accepts a floating point number and returns the nearest 32-bit single precision float representation of a Number. If the given number itself is an integer this function returns the same.

Syntax

Its Syntax is as follows

Math.fround(160.98)

Example

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var result = Math.fround(160.98);
      document.write("Fround value: "+result);
   </script>
</body>
</html>

Output

Fround value: 160.97999572753906