For decimal type lengths > 128 bytes, the power term becomes infinity. This is probably unlikely in practice, but the following expression for the max precision is equivalent and avoids this overflow:
(int) Math.Floor((8.0 * length - 1) * Math.Log10(2))
This is what's used in Parquet C++, see apache/arrow@423ca16
For decimal type lengths > 128 bytes, the power term becomes infinity. This is probably unlikely in practice, but the following expression for the max precision is equivalent and avoids this overflow:
This is what's used in Parquet C++, see apache/arrow@423ca16