Accuracy of toString() operation

Hi there,
I was wondering about the |> toString() function of the flux language. As there are no parameters my understanding would be that the entire accuracy of a floating point value would be displayed, however this is not entirely true.
Due to unit testing I noticed that this method has the same accuracy as the c# toString method: When comaring the result from influx with the original value via “==” they are different, but the string representation is the same. (I parse the returned value back to double before comparing)

Is there a way to convert to string lossless? i.e. increasing the number of decimal places or converting to hex

Why do I need this?
Because of existing system requirements I have to allow for different types to be stored by the same sensor. I do this by appending the Value type to the value Field name (i.e. value becomes valueInt). So when querying I do:
|> toString
|> group()

In 99% of the time these operations aren’t necessary, but I still need to fulfill 100% of the system requirements.
On a side note, do these operations significantly impact performance? The query they would be used in usually only filters for a sensor and returns raw data, so something like:
from(bucket: “myBucket”)
|> range(start: …, stop: …)
|> filter … // this filters for all fields of that same sensor (like valueInt, valueDbl, valueString)
|> toString()
|> group()

Thank you for your help!

figured it out myself

performance: Yes it has quite a large impact, scales with the amount of data though

due to the performance impact and because I rarely ever need the functionality ill just not do this, so i dont need the accuracy

1 Like

@TomsCodingCode thanks for sharing your conclusion/solution.