运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Math</h1> <h2>The Math.fround() Method</h2> <p>Math.fround() returns the nearest 32-bit single precision float representation of a number:</p> <p id="demo"></p> <script> let a = Math.fround(2.60); let b = Math.fround(2.50); let c = Math.fround(2.49); let d = Math.fround(-2.60); let e = Math.fround(-2.50); let f = Math.fround(-2.49); document.getElementById("demo").innerHTML = a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e + "<br>" + f; </script> </body> </html>