How to save numerical values with whole precision to a database?

3 次查看(过去 30 天)
I need to save numerical values of type double to Postgresql 11 database using jdbc connection.
I have observed that the values that the database is saving do not have 16 digits of precision but only 15.
In the result when I upload numerical data to the database, download it and compare with the original I receive different values.
I have tried to use in the target database table types numeric, numeric(38,16) and double precision, but the result was always the same - the data were rounded to 15 digits.
I have found a workaround changing the doubles to string using num2str(value,17) saving string to the database and converting the string in the database to numeric and this solution works, but is there an easier way to do it?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by