【Z】1.#QNAN、1.#IND和1.#INF等“…

本文介绍了浮点数中的特殊值,包括NaN(Not a Number)、Infinity(INF)和Indeterminate(IND)。NaN分为Quiet NaN(QNaN)和Signalling NaN(SNaN),用于表示无法表示的真实数值。INF表示无穷大,IND表示无限小但不确定。针对这些特殊值,文章提到了C语言和C++中进行判断的函数或方法,并提供了相关参考资料。
摘要由CSDN通过智能技术生成
首先说明:1.#QNAN是一个打印呈现,QNAN是指Quiet Not a Number,类似的浮点错误还有SNaN(Signaling Not a Number),通常如0.0/0.0、给负数开平方根等溢出或无效运算就会产生一个NAN结果的表示值。

NaN及两种浮点错误的说明如下:
The value NaN (Not a Number) is used to represent a value that does not represent a real number. NaN’s are represented by a bit pattern with an exponent of all 1s and a non-zero fraction. There are two categories of NaN: QNaN (Quiet NaN) and SNaN (Signalling NaN).A QNaN is a NaN with the most significant fraction bit set. QNaN’s propagate freely through most arithmetic operations. These values pop out of an operation when the result is not mathematically defined.An SNaN is a NaN with the most significant fraction bit clear. It is used to signal an exception when used in operations. SNaN’s can be handy to assign to uninitialized variables to trap premature usage.Semantically, QNaN’s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值