diff options
author | John McCall <rjmccall@apple.com> | 2019-05-31 01:21:36 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2019-05-31 01:21:36 +0000 |
commit | 059b823e709a90d3b5d2d24663830e59b3bdded9 (patch) | |
tree | 39392b05b6b230e4acec135a3ed95dbf1e6cb95c /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | b5a45bb77e05647f04bbd9780d70aabe9f251155 (diff) | |
download | bcm5719-llvm-059b823e709a90d3b5d2d24663830e59b3bdded9.tar.gz bcm5719-llvm-059b823e709a90d3b5d2d24663830e59b3bdded9.zip |
Fix the predefined exponent limit macros for the 16-bit IEEE format.
The magnitude range of normalized _Float16 is 2^-14 (~6e-5) to
(2-2^-10)*2^15 (65504). You might think, then, that the code is
correct to defne FLT16_MIN_EXP and FLT16_MAX_EXP to be -14 and 15
respectively. However, for some reason the C specification actually
specifies a bias for these macros:
C11 5.2.4.2.2:
- minimum negative integer such that FLT_RADIX raised to one less than
that power is a normalized floating-point number, e_min:
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
- maximum integer such that FLT_RADIX raised to one less than that
power is a representable finite floating-point number, e_max:
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
FLT16_MIN_EXP and FLT16_MAX_EXP should clearly be biased the same way,
and other compilers do in fact do so, as do our OpenCL headers for `half`.
Additionally, FLT16_MIN_10_EXP is just wrong.
llvm-svn: 362183
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
0 files changed, 0 insertions, 0 deletions