How NaN values are represented.
Declared in <llvm/ADT/APFloat.h>
enum class fltNanEncoding : int;
Currently used with fltNonfiniteBehavior::NanOnly; using a variant other than IEEE while having IEEE non-finite behavior is liable to lead to unexpected results.
| Name | Description |
|---|---|
IEEE | Represents the standard IEEE behavior where a value is NaN if its exponent is all 1s and the significand is non-zero. |
AllOnes | Represents the behavior in the Float8E4M3FN floating point type where NaN is represented by having the exponent and mantissa set to all 1s. This behavior matches the FP8 E4M3 type described in https://arxiv.org/abs/2209.05433. We treat both signed and unsigned NaNs as non-signalling, although the paper does not state whether the NaN values are signalling or not. |
NegativeZero | Represents the behavior in Float8E{5,4}E{2,3}FNUZ floating point types where NaN is represented by a sign bit of 1 and all 0s in the exponent and mantissa (i.e. the negative zero encoding in a IEEE float). Since there is only one NaN value, it is treated as quiet NaN. This matches the behavior described in https://arxiv.org/abs/2206.02915 . |