问题描述
isnormal() 参考页面说:
判断给定的浮点数 arg 是否正常,即是既不是零、次正规、无限,也不是 NaN.
Determines if the given floating point number arg is normal, i.e. is neither zero, subnormal, infinite, nor NaN.
很清楚数字为零、无限或 NaN 的含义.但它也说不正常.什么时候是次正规数?
It's clear what a number being zero, infinite or NaN means. But it also says subnormal. When is a number subnormal?
推荐答案
在IEEE754标准中,浮点数用二进制科学记数法表示,x = M × 2e.这里M是尾数,e是指数.在数学上,您始终可以选择指数,以便 1 ≤ M < 2.* 但是,由于在计算机表示中,指数只能具有有限范围,因此是一些大于零但小于 1.0 × 2emin 的数字.这些数字是 subnormals 或 denormals.
In the IEEE754 standard, floating point numbers are represented as binary scientific notation, x = M × 2e. Here M is the mantissa and e is the exponent. Mathematically, you can always choose the exponent so that 1 ≤ M < 2.* However, since in the computer representation the exponent can only have a finite range, there are some numbers which are bigger than zero, but smaller than 1.0 × 2emin. Those numbers are the subnormals or denormals.
实际上,尾数的存储没有前导 1,因为总是有前导 1,除了对于次正规数(和零).因此解释是,如果指数是非最小的,则有一个隐含的前导 1,如果指数是最小的,则没有,并且该数字是次正规的.
Practically, the mantissa is stored without the leading 1, since there is always a leading 1, except for subnormal numbers (and zero). Thus the interpretation is that if the exponent is non-minimal, there is an implicit leading 1, and if the exponent is minimal, there isn't, and the number is subnormal.
*) 更一般地说,1 ≤ M < B 对于任何基础-B 科学记数法.
*) More generally, 1 ≤ M < B for any base-B scientific notation.
这篇关于什么是次正规浮点数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!