Math Error (possible glitch)

edited July 2016 in p5.js

Hi there

I was doing a IHM ( interface human-machine) for a Automation and Control project (I'm a student and new to p5), where I needed to fill a tank with a liquid of random pH, then I need to add Sulfuric Acid or Caustic Soda to make the pH 7. But I was getting the same error almost everytime I ran the program, the pH never reached 7 because of a decimal imprecision (which I was adding 0.3pH/sec or reducing it 0.1pH/sec). But I noticed that the problem wasn't in my code, but in the math of p5.

I've solved my problem, but I wanted to report the existence of it here...

SS of my project and the part of the code where it calculated the pH of the liquid:

To prove the problem existed I've created a simple program (subtracting a decimal [0.1] from a whole number [20] ) :

Sorry for my bad English (and the poorly written post, first time here...)



Sign In or Register to comment.