diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-19 01:37:31 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-19 01:37:31 +0000 |
commit | cb3ca456dec1fe053845d6b3120b00805da2a46e (patch) | |
tree | a5a521b789a2bbe4528620b430f00bcfe4f656f8 /gcc/invoke.texi | |
parent | 2976822627f44f301cb3a74e71b9a0127aecec71 (diff) | |
download | gcc-cb3ca456dec1fe053845d6b3120b00805da2a46e.tar.gz |
* invoke.texi (Warning Options): Add an explanation of why
you might want the -Wfloat-equal flag.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32061 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/invoke.texi')
-rw-r--r-- | gcc/invoke.texi | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/invoke.texi b/gcc/invoke.texi index dbae2217513..09cbfc90fee 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -1724,6 +1724,17 @@ struct s x = @{ 3, 4 @}; @item -Wfloat-equal Warn if floating point values are used in equality comparisons. +The idea behind this is that sometimes it is convenient (for the +programmer) to consider floating-point values as approximations to +infinitely precise real numbers. If you are doing this, then you need +to compute (by analysing the code, or in some other way) the maximum or +likely maximum error that the computation introduces, and allow for it +when performing comparisons (and when producing output, but that's a +different problem). In particular, instead of testing for equality, you +would check to see whether the two values have ranges that overlap; and +this is done with the relational operators, so equality comparisons are +probably mistaken. + @item -Wtraditional (C only) Warn about certain constructs that behave differently in traditional and ANSI C. |