java - 机器和数据库中的最大小数位数

标签 java c++ sql operating-system

<分区>

1) 对于给定机器,可以存储在磁盘上的浮点十进制数是否有最大小数位数?

2)给定的关系数据库管理系统可以使用的小数位数是否有最大限制?

3) 假设 C++ 代码使用存储在磁盘上的这个精确数字,即完整的小数位。如果C++代码输出的结果数(如乘以2),小数位数超过db允许的,db如何处理?抛出异常还是四舍五入到底层硬盘允许的最大位数?

最佳答案

1) is there a maximum number of decimal places for a floating point decimal number that can be stored on disk for a given machine?

通常, float 的精度是由处理器或浮点处理器决定的。

有“大数”库可以扩展 float 的精度。

因此,磁盘上可以存储的最大小数位数取决于:
1) 磁盘的大小。
2) 浮点实现的大小(例如大数库)。

2)is there a maximum number of decimal places that a given relational database management system can work with?

是的。每个 RDBMS 都有自己的限制。数据库之间没有标准限制。您必须调查数据库并找出答案。

3)Suppose C++ code uses this exact number as stored on disk ie full decimal places. If the resulting number that C++ code outputs (eg multiply the number by 2), and the number of decimal places exceed that allowed by db, how does db handle it? Throw exception or round up to the maximum number of places allowed by the underlying hard disk?

溢出或容量限制取决于浮点实现(处理器和数据库实现)。有些实现可能会截断,有些可能会舍入;一切取决于。对于数据库,对于处理精度溢出或容量限制,所有数据库都没有标准。您必须调查您计划使用的数据库或所有数据库。

也可以在互联网上搜索“IEEE 浮点标准”。

关于java - 机器和数据库中的最大小数位数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56117131/

相关文章:

SQL Server 2012 滞后和超前函数

sql - 如果某个值更新列

sql - 我无法为具有最小值的获取行编写选择

Java 的 setFilterBitmap 在 Objective-C 中等效

java - 测试 Spring Boot 应用程序的最佳方法是什么?通过服务器参与或通过创建模拟环境?

c++ - 线程安全流和流操纵器

c++ - 在 Windows 中使用 gmail 作为 smtp 中继器在 c++ 中发送邮件

java - 使用键、值对实现 MaxHeap

java - 列中的多个值

c++ - 在 Qt 中移动 Snake 时遇到问题