-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Milestone
Description
When the client starts building LP, it converts double and float values to a string:
if (value is double || value is float)
{
sb.Append(((IConvertible)value).ToString(CultureInfo.InvariantCulture));
}
However, CultureInfo.InvariantCulture
may not preserve full precision.
Whereas, if that's replaced with "R"
the precision will be maintained:
For example
using System;
using System.Globalization;
public class Program
{
public static void Main()
{
double a = (double) 459.29587181322927;
string b = a.ToString(CultureInfo.InvariantCulture);
Console.WriteLine(b);
string c = a.ToString("R");
Console.WriteLine(c);
}
}
Generates
459.295871813229
459.29587181322927
However, this isn't a full solution, because the use of R
may also add unexpected precision. If we redefine a
to be 45.29587181323112
in the example above, then we get 45.295871813231123
because of the way that C# handles conversion.
Steps to reproduce:
List the minimal actions needed to reproduce the behavior.
- Use the client
- Define a double with >15 significant numbers
- Write into InfluxDB
Expected behavior:
The full precision should be sent
Actual behavior:
The value will have lost precision
Specifications:
- Client Version:
- InfluxDB Version: 1.x/2.x
- Platform: 4.7.0
Metadata
Metadata
Assignees
Labels
No labels