摘要
为弄清浮点类型数据在应用中存在"异常"现象的原因,研究了浮点类型数据在内存中的存储形式,得到与其在内存中存储规范一致的结果。分析浮点类型数据在内存中存储形式对应的理论区间并进行实验验证,得出浮点类型数据的精度(对于规范化浮点类型数据,float15~17位),进而对浮点类型数据在应用中的一些异常现象进行合理解释,比如"大数吃小数"、输出格式控制以及输出结果与预期不一致等。通过对浮点类型数据在计算机内存中表达形式的理论分析和实验验证,实现对实际数据进行离散化处理,为计算机内存中的表示和相关计算带来帮助。
This paper studies the storage form of floating-point type data in memory and explains why there is an "abnormal" phenome. non in the application. The result verified through experiments is consistent with the storage specification of floating-point type data in memory. Through the analysis,the theoretical interval corresponding to the storage form in the floating-point type data memory is ob. tained and experimentally verified,and then the accuracy of the floating-point type data is analyzed(For normalized floating-point type data,the effective number of float type is 6~8 and double type is 15~17). Furthermore,some explanations on the application of floating-point type data are reasonably explained,such as "large numbers eat decimals",output format control,and output results are inconsistent with expectations.
作者
肖红德
XIAO Hong-de(School of Minsheng,Henan University;School of Mathematics and Statistics,Henan University,Kaifeng 475004,China)
出处
《软件导刊》
2019年第4期50-56,共7页
Software Guide
基金
河南省高等学校重点科研项目(16A110010)
河南大学民生学院教学改革研究项目(MSJG2016042)
关键词
浮点类型
有效位数
存储单元
数制转换
不精确表示
floating-point type
number of significant digit
storage unit
number system conversion
inaccurate representation