Is this normal or a bug ?
Dom DiSc
dominikus at scherkl.de
Mon Jul 3 14:22:27 UTC 2023
On Monday, 3 July 2023 at 08:24:22 UTC, Mehdi wrote:
> ```d
> extern (C++) float float_test(float x, float y);
> {
> assert(10.1 + 20.6 == float_test(10.1, 20.6));
> }
> ```
In C literals are always float unless you mark them as double
(10.1L).
In D 10.1 is a double literal, which is auto-convered to float as
parameter to your test.
If you want to calculate with float, you need to write 10.1f (and
10.1L would be real)
even 10.1 != 10.1f without any addition involved.
More information about the Digitalmars-d
mailing list