-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
My goal is to insert my float
variable in the database.
But when I call the addField
method and cast the float
into double
, the variable gets a weird noise (little supplement) at the end:
This code:
float value = 3.141592f
influxdb::Point p1{"cpu"};
p1.addField("value", (double) value);
std::cout << p1.getFields() << std::endl;
displays this output:
value=3.141592025756835938
As you can see, a few digits are added at the end of the value, not far from the last digit.
I also tried casting with static_cast<double>(value)
but it didn't work (same if I pass the float
as is, without casting).
Edit:
To sum up, I'd like to know if it's possible to have as much precision as if I inserted a double
:
value=3.141592000000000162
NB: with such a value, InfluxDB ignores the 162 at the end, and give me the tuple when I do a query with WHERE value=3.141592
(which is not the case with the float
result).