I have an application that stores monetary amounts. I want to store this in Cloud Spanner. Using a FLOAT64
is dangerous because of well-known problems with floating point accuracy.
Other databases offer a NUMERIC
type for just this kind of use-case. What should I do in Cloud Spanner?
Cloud Spanner now supports NUMERIC data type with 38 decimal digits of precision, including 9 after decimal points. Please refer to the documentation here.