Is this normal or a bug ?

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Jul 3 08:28:23 UTC 2023


Float comparisons can be quite tricky.

You probably want to use std.math : isClose.

https://dlang.org/phobos/std_math_operations.html#.isClose

```d
{
	import std.math;
	assert((10.1+20.6).isClose(float_test(10.1, 20.6)));
}
```

For future reference, questions like these are better targeted towards 
the learn news group, rather than general.

https://forum.dlang.org/group/learn


More information about the Digitalmars-d mailing list