On 13/11/2024 22:34, James K. Lowden wrote:
On Thu, 14 Nov 2024 10:04:59 +0100
David Brown via Gcc wrote:
No. This is - or at least appears to be - missing critical thinking.
You are explaining this to someone who designed research databases and
who implemented quantitative models that ran
On Thu, 14 Nov 2024 10:04:59 +0100
David Brown via Gcc wrote:
> No. This is - or at least appears to be - missing critical thinking.
You are explaining this to someone who designed research databases and
who implemented quantitative models that ran on them. You're entitled
to your opinion, of
On 12/11/2024 22:44, James K. Lowden wrote:
On Tue, 12 Nov 2024 18:12:50 +0100
David Brown via Gcc wrote:
Under what circumstances would you have code that :
...
d) Would be perfectly happy with "x" having the value 2.225e-307 (or
perhaps a little larger) and doing the division with that.
I
> It's also not unusual to start with "x" statically initialized to zero,
> and use that as an indication to invoke the initialization routine.
This is exactly what I have. In my case, if the value remains 0.0 it
means the calculations for those metrics are not applicable.
The suggestion to u
On Tue, 12 Nov 2024 18:12:50 +0100
David Brown via Gcc wrote:
> Under what circumstances would you have code that :
...
> d) Would be perfectly happy with "x" having the value 2.225e-307 (or
> perhaps a little larger) and doing the division with that.
>
> I think what you really want to check i
On Mon, 11 Nov 2024 21:14:43 + (UTC)
Joseph Myers via Gcc wrote:
> On Sat, 9 Nov 2024, Sad Clouds via Gcc wrote:
>
> > Even though there is nothing unsafe here and comparison to floating
> > point 0.0 value is well defined.
>
> The point of the warning is that *if you are writing code that
Hello,
On Tue, 12 Nov 2024, Thomas Koenig via Gcc wrote:
> Am 12.11.24 um 17:25 schrieb Michael Matz via Gcc:
>
> > If you think of float as
> > approximated reals, then yes, division by zero is undefined (not
> > somewhat undefined!).
>
> Depends on how you look at it.
>
> IEEE 754-2008, for
Hello,
On Tue, 12 Nov 2024, Sad Clouds via Gcc wrote:
> > I don't think this has anything to do with whether one operand of the
> > comparison is a constant. It's still the case when comparing with 0.0
> > that it's OK if your algorithm is designed such that the other operand
> > is exact, an
On Tue, 12 Nov 2024 17:25:14 +0100 (CET)
Michael Matz wrote:
> Other values for the divisor will also produce Inf. If your goal was to
> avoid getting Inf, then checking for equality with zero _won't_ do:
Yes you are correct, there are many different ways to overflow and
underflow a floating p
On Tue, 12 Nov 2024, David Brown via Gcc wrote:
On 12/11/2024 15:29, Sad Clouds via Gcc wrote:
On Mon, 11 Nov 2024 21:14:43 + (UTC)
Joseph Myers wrote:
I don't think this has anything to do with whether one operand of the
comparison is a constant. It's still the case when comparing with
Am 12.11.24 um 17:25 schrieb Michael Matz via Gcc:
If you think of float as
approximated reals, then yes, division by zero is undefined (not
somewhat undefined!).
Depends on how you look at it.
IEEE 754-2008, for example, says in 7.3
"The default result of divideByZero shall be an ∞ correctl
On 12/11/2024 15:29, Sad Clouds via Gcc wrote:
On Mon, 11 Nov 2024 21:14:43 + (UTC)
Joseph Myers wrote:
I don't think this has anything to do with whether one operand of the
comparison is a constant. It's still the case when comparing with 0.0
that it's OK if your algorithm is designed su
On Mon, 11 Nov 2024 21:14:43 + (UTC)
Joseph Myers wrote:
> I don't think this has anything to do with whether one operand of the
> comparison is a constant. It's still the case when comparing with 0.0
> that it's OK if your algorithm is designed such that the other operand is
> exact, and
On Sat, 9 Nov 2024, Sad Clouds via Gcc wrote:
> Even though there is nothing unsafe here and comparison to floating
> point 0.0 value is well defined.
The point of the warning is that *if you are writing code that thinks of
floating-point values as being approximations to real numbers* then such
On Sun, 10 Nov 2024, 11:13 Alexander Monakov, wrote:
>
> On Sun, 10 Nov 2024, Jonathan Wakely via Gcc wrote:
>
> > But 1 - (10 * 0.1) won't, and so the warning is pointing out that any
> exact
> > equality comparisons can be affected by this kind of problem. If you
> don't
> > like the warning, d
On Sun, 10 Nov 2024, Jonathan Wakely via Gcc wrote:
> But 1 - (10 * 0.1) won't, and so the warning is pointing out that any exact
> equality comparisons can be affected by this kind of problem. If you don't
> like the warning, don't enable it.
I think OP's questions are in good faith and your l
On Sun, 10 Nov 2024 09:45:41 +
Jonathan Wakely wrote:
> Does clang only have a special case for 0.0, or for any literal value?
>
It looks like clang can detect which floating point literals can be
represented exactly and does not generate any warnings for those.
$ cat test.c
#include
int
On Sun, 10 Nov 2024, 08:26 Sad Clouds via Gcc, wrote:
> On Sat, 9 Nov 2024 11:49:56 -0800
> Andrew Pinski wrote:
>
> > You can use the diagnostic pragma to disable it directly for the
> statement.
>
> Thanks for the tip. After a quick search, I came across this page,
> which explains it:
> https
On Sat, 9 Nov 2024 11:49:56 -0800
Andrew Pinski wrote:
> You can use the diagnostic pragma to disable it directly for the statement.
Thanks for the tip. After a quick search, I came across this page,
which explains it:
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
> But I will not
On Sat, Nov 9, 2024, 11:19 AM Sad Clouds via Gcc wrote:
> Hello, I don't know if this is a known GCC bug or intentional design,
> but code like this:
>
> double value = 0.0;
> ...
> if (value == 0.0)
> {
> ...
> }
>
> Results in the following warning with gcc-12.2.0:
>
> "... warning: com
Hello, I don't know if this is a known GCC bug or intentional design,
but code like this:
double value = 0.0;
...
if (value == 0.0)
{
...
}
Results in the following warning with gcc-12.2.0:
"... warning: comparing floating-point with ‘==’ or ‘!=’ is unsafe"
Even though there is nothing
21 matches
Mail list logo