Jump to content

backrom

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by backrom

  1. Hi forum,

    I have encountered a calculation error on my PC.

    The script is simple and its running in an Adobe PDF but i get the same result on the w3schools-try-it-page (Chrome Browser)

     

    <!DOCTYPE html>
    <html>
    <body>
    <p>y = 1.21, calculate x = y - 1, and display x:</p>
    <button onclick="myFunction()">Try it</button>
    <p id="demo"></p>
    <script>
    function myFunction() {
    var y = 1.21;
    var x = y - 1;
    document.getElementById("demo").innerHTML = x;
    }
    </script>
    </body>
    </html>
    the result :

    y = 1.21, calculate x = y - 1, and display x:

    Try it

    0.20999999999999996

    is close to correct, but its wrong!

    After changing my initial values to 1.25

    <!DOCTYPE html>
    <html>
    <body>
    <p>y = 1.25, calculate x = y - 1, and display x:</p>
    <button onclick="myFunction()">Try it</button>
    <p id="demo"></p>
    <script>
    function myFunction() {
    var y = 1.25;
    var x = y - 1;
    document.getElementById("demo").innerHTML = x;
    }
    </script>
    </body>
    </html>
    the result is correct

    y = 1.25, calculate x = y - 1, and display x:

    Try it

    0.25

    I know that I could include a math.round fonction, but i'm dealing with many big sheets that come from an official goverment site.

    Our PC are win8 and (hope) fully patched. The script is running in latest Adobe reader DC.

    My question is:

    Is this my local problem ?

    or is it a general problem, and you all have to deal with that?

    Thanks in advance

    Romain

     

×
×
  • Create New...