Precision of double on Tigergraph

Hi there,

Can I check with you, what is the maximum number of digits which can be stored to the right of the decimal point on Tigergraph. It seems to be five, but I want to clarify what the number is.

Many thanks.

Kind regards,

In GraphStudio or GSQL Console or curl results, the float/double type result has been trimmed to 5 digits. The underlying storage has full precision. So it is during the calculation of GSQL.

If you want to print full provision in the result. You can try to modify the to_string function in <tigergraph_root>/app/3.0.5/dev/gdk/gsql/src/QueryUdf/ExprFunctions.hpp

Change sprintf function in the to_string function to sprintf(result, “%.18g”, val);
This way when you output float/double, call the to_string function to print the string value.

You will get something like:
“res”: “0.123456791043281555”

Hi Xinyu,

Thank you very much for following up on my question. Your answer makes perfect sense.

Kind regards,

Hi Xinyu,

Could you please also tell us after we do to_string we get the values in a string (with high precision), how can we convert this value from the string to float/double keeping the same precision??



By default, without calling to_string, the float/double type attributes already have full precision.

Since you already have the access to the attributes from the GSQL query, I don’t think you will need to convert it back from a string.

Could you let me know your use case if you have to convert it back?