Found by typo, forget to remove `isNaN` and code still compiles giving wrong result:
```
import std.math;
int main()
{
float a = 0, b = 10_000;
static assert (!__traits(compiles, q{
// isNaN wasn't removed during copy-paste
// but code still compiles with wrong result
assert (a.approxEqual(b.isNaN) == false);
}), "This code must not compile!");
return 0;
}
```
Comment #1 by simen.kjaras — 2017-07-12T10:39:54Z
There's nothing particular about approxEqual in this case - at least 26 out of 70 functions in std.math accept bools for at least one of their parameters.
This bug report basically boils down to this code:
float f = false;
This compiles and is valid D. (and the value of f is 0)
Comment #2 by dlang-bugzilla — 2017-07-15T02:49:13Z
(In reply to Simen Kjaeraas from comment #1)
> This bug report basically boils down to this code:
>
> float f = false;
That doesn't make sense and doesn't seem useful, so let's reopen it as an accepts-invalid.
Comment #3 by robert.schadek — 2024-12-13T18:53:19Z