On Tuesday, 18 October 2022 at 18:59:37 UTC, rikki cattermole
wrote:
Well its not a type system issue.
Making u = n, that'll returns true.
So the problem almost certainly lies with IEEE-754.
They are horrible to compare (float/double).
Unfortunately you are stuck calling functions like isClose to
compare.
https://dlang.org/phobos/std_math_operations.html#.isClose
Hi Rikki, thanks for the rapid reply.
I'm not so sure it isn't a type issue, tbh. The only reason being
that the opEquals() works whenever I call it directly (ignoring
the comparison of proximity to a value for the moment)
but doesn't work when I use "=="
stripped down to just the two lines that are causing issues:
```
//assert(opEquals(u,n)); // this works fine
assert(u == n); // this fails. Why?
```
I guess to put it more bluntly, I should ask "why is opEquals
working when I call it directly, but when I try to use the
equality check, which should be CALLING opEquals, it doesn't
appear to do so?"