从DOUBLE(15,2)转换为DECIMAL(15,2) [英] Converting from DOUBLE (15,2) to DECIMAL (15,2)

查看:632
本文介绍了从DOUBLE(15,2)转换为DECIMAL(15,2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在mysql中的双精度和十进制之间转换时,会不会有任何数据丢失?

Will there be any data loss when converting between double and decimal in mysql?

推荐答案

双精度数的精度约为16位十进制数字.因此答案是否定的,因为这两种类型都声明为具有15位精度的十进制数字. (如果类型有16位数字,则取决于存储的数字,因为double的精度实际上在15到16位数字之间.)

Doubles have ~16 decimal digits of precision. So the answer is no, since both types are declared to have 15 decimal digits of precision. (If the types had 16 digits, it would depend on the number stored since the precision of doubles is actually between 15 and 16 digits.)

这篇关于从DOUBLE(15,2)转换为DECIMAL(15,2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆