I want to send this to a gauge and I really need just 2 decimal places ... 20.09
Is this at all possible, as i have looked for an hour and cannot find an answer for Arduino ?
An Arduino float is always going to have 6 or 7 decimal places. A string representation of a float can have any number of decimal places, or at least up to 7
But, you say
"send this to a gauge"
via what method? The reason you have a tiny residual on the float is because of representation limitations in the datatype float. That'll be similar in any system, and should not be of concern.
Why does your "gauge" insist on showing residuals of irrelevancy?
I have misunderstood what float does in Arduino, I thought you could change it to as few decimal places as I liked, as I have used the above as text and the used dtostrf.
But I can see that in Arduino it is fixed to 8 decimal places.
This is going to be sent out to Node-RED gauge and a database. This does work in Node-RED
No, it's not. The float type is fixed to the IEEE 754 32-bit format. On ESP8266 you can also get IEEE 754 64-bit format by using 'double'. dtsotrf() will give an approximate ASCII representation of the float to a specified number of decimal places. With ESP8266, you can also use sprintf() to do this..
No, not with any normal computer. A float can represent a number with 6 to 7 total digits of accuracy. It is not possible to represent the exact value of all numbers with a given number of decimal places.
For example, 0.1 cannot be represented exactly by a float value. I suspect that your example of 20.09 cannot be represented exactly, either.
Just print out the value to two decimal places after the decimal point.