Git Product home page Git Product logo

Comments (2)

alcz avatar alcz commented on July 22, 2024

This is how floating point unit operates on a CPU, not programming language issue.
Your example redacted below, to help you understand, that floating point numbers are not exact numbers.

   LOCAL a1, a2, a3, a4, sub1, sub2

   a1 = 850.01
   a2 = 6.29
   a3 = 11.00
   a4 = 60.29
   sub1 = a1 + a2 + a3 + a4
   sub2 = 927.59
   ? Str( sub1, 29, 19 ), Str( sub2, 29, 19 )
   IF Round( sub1, 2 ) = Round( sub2, 2 )
      ? Str( sub1 ) + Str( sub2 )
      ? "They are the same."
   ELSE
      ? Str( sub1 ) + Str( sub2 )
      ? "THEY ARE NOT THE SAME !!!"
   ENDIF

result:

      927.5899999999999000000       927.5900000000000000000
       927.59       927.59
They are the same.

https://os.allcom.pl/hb/3.2/#!eJx9jLsKwkAQRfv9ihsrQ8KyO4mPLRYJErDwAWpjOZINCj4gj8K_d1eCdhZ3mDncOevdsliDdQomn8wnT9H2Z_2ZJFjb-URJpQWTnUoygjOrtVRKcG6nKpBQh_WWhCnhLOE8IPLI0ExOjFig7ZrxoCWTQhvE6RfSD4prjebZP6pvG7H3_BB90GAMlTgZNgp0dLy4F7hx6C4OLd-dHAl3a92fj1V5QrEvsd0d4Q8cik2JKIr846O61m-emUwX

from core.

hoscarl avatar hoscarl commented on July 22, 2024

Many thanks for your explanation it all makes sence now.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.