Floating point values displayed using scientific notation when they don't need to be


When querying the database, Influx changes the formatting of field values depending on the magnitude of the value: if the value is less than one million it is displayed as a standard floating point number; once the value hits one million, it is displayed using scientific notation.

For example:

SELECT max_eImport,max_eExport,avg_Pac,avg_VAac FROM usagemeter WHERE __devhash='F09A5F58294B2072C9425310E1BF166C' AND time >= '2017-04-09 22:00:00' limit 10
name: usagemeter
time                 max_eImport     max_eExport avg_Pac             avg_VAac
----                 -----------     ----------- -------             --------
2017-04-09T22:00:00Z 999847.168      385.6       -34656.68999999999  -37979.73333333333
2017-04-09T22:30:00Z 999869.12       385.6       -43978.59666666666  -46754.95
2017-04-09T23:00:00Z 999886.72       385.6       -36101.23333333332  -39262.423333333325
2017-04-09T23:30:00Z 999928.32       385.6       -83579.21666666666  -85375.02666666667
2017-04-10T00:00:00Z 999979.072      385.6       -105082.14033333334 -106872.97666666665
2017-04-10T00:30:00Z 1.000030016e+06 385.6       -100663.81033333334 -102459.67666666667
2017-04-10T01:00:00Z 1.000049984e+06 385.6       -38315.16333333333  -41279.11
2017-04-10T01:30:00Z 1.0000672e+06   385.6       -34808.713333333326 -37985.78666666667
2017-04-10T02:00:00Z 1.000098816e+06 385.6       -64623.396551724145 -66798.20689655172
2017-04-10T02:30:00Z 1.000129472e+06 385.6       -60940.920000000006 -63015.34999999999

There appear to be enough significant digits in the field value to make the use of scientific notation unnecessary.
Is this threshold configurable?

(Note that it doesn’t matter if the output format is “column”, “csv” or “json”, the numeric formatting is always the same.)

Jeremy Begg

I wonder about this too. It effects ints as well as floats
this issue Have an option to return large numbers in json as standard format instead of scientific notation · Issue #8077 · influxdata/influxdb · GitHub blames it on go. and references this issue
encoding/json: encode precise floating point integers using %.0f, not %g · Issue #6384 · golang/go · GitHub, but the go issue is about json, and as the OP points out, the issue occurs for all formats, not just json.
It is worse than just ‘display’ format. I want to feed query results into other applications.
If it is not configurable, is there a good workaround?

I just realized that my problem only occurs using the cli as in ‘influx v1 shell’
if i use the http interface, which is what I will do in prodcution, influx does not convert large ints to scientific notation, Thus this is merely an annoyance not an actual problem for me.