Real implicitly converts to float?

Guillaume Piolat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 22 01:57:38 PDT 2016


On Wednesday, 22 June 2016 at 05:04:42 UTC, Tofu Ninja wrote:
> Is this intended behavior? I can't seem to find it documented 
> anywhere, I would think the loss in precision would atleast be 
> a warning.
>
> real x = 10;
> float y = x; // No error or warning
>
> real to double and double to float also work.

Intended behaviour (in TDPL and all), and same behaviour than C.
I'm not sure of the reason.


More information about the Digitalmars-d-learn mailing list