C99 是否假定支持次正规数?

Does C99 assume that subnormal numbers are supported?

C99 假设支持次正规数吗?

发件人:

我得出结论,C99 支持次正规数。这个结论正确吗?

Does C99 assume that subnormal numbers are supported?

没有。 5.2.4.2.2。该语言定义了一个浮点数模型。然后该语言在该模型 中定义了次正规浮点数。然后建立一个接口,如何检测和使用次正规浮点数,以及如何在极端情况下处理它们——我的意思是,何时引发异常,何时不引发。

这并不意味着底层架构使用此模型来表示浮点数。本意是把标准写成abstract way, trying to provide an interface without requiring how it should be implemented. Note 16:

  1. The floating-point model is intended to clarify the description of each floating-point characteristic and does not require the floating-point arithmetic of the implementation to be identical.

如果实现 implements Annex F, then 浮动类型匹配 IEC 60559 中描述的格式,因此它将有次正规数。这是推荐做法,但可选,用宏检测 - 没有要求。

the presence of FP_SUBNORMAL classification macro

实现可能会提供更多 FP_[A-Z]* 宏,用于额外的“浮点值种类”。

the fact that in IEEE 754 support of subnormal numbers is required

但是 C 不需要 IEEE 754 支持。