Float Problem
lucasromeiro opened this issue · 1 comments
I use ESP8266 and I program on the newer versions of the platform and use the core arduino 2.4.2
I have a problem with my code when I use the library. Be it the DHT22 library or other Adafruit libraries like Adafruit_MAX31865.
The problem may be in the Adafruit_Sensor.h library.
I do not know how to say it, but when I use any of these libraries, whatever code I'm working on has FLOAT changes.
Behave strangely!
for example:
if I assign a float value to a float variable this occurs:
var = 988.78;
when checking the variable has different values such as:
988.7799999999999727
The behavior is similar in every case!
FLOAT variables are ALWAYS with strange decimal places, adding or subtracting small values.
Even the IDE platformIO shows that the variable is strange!
Where it should have 988.78, has 988.7799999999999727.
There is something very wrong and you are disturbing me!
Can you help me?
this issue is off topic
https://www.geeksforgeeks.org/ieee-standard-754-floating-point-numbers/