Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Enregistrer le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <body> <h1>JavaScript Math</h1> <h2>La méthode Math.f16round()</h2> <p>Math.f16round() renvoie la représentation en virgule flottante simple précision de 16 bits la plus proche d'un nombre :</p> <p id="demo"></p> <script> let a = Math.f16round(2.60); let b = Math.f16round(2.50); let c = Math.f16round(2.49); let d = Math.f16round(-2.60); let e = Math.f16round(-2.50); let f = Math.f16round(-2.49); document.getElementById("demo").innerHTML = a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e + "<br>" + f; </script> </body> </html>