Real implicitly converts to float?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 23 08:25:49 PDT 2016


On 6/23/16 11:16 AM, Tofu Ninja wrote:
> On Thursday, 23 June 2016 at 13:57:57 UTC, Steven Schveighoffer wrote:
>> Whenever you work with floating point, the loss of precision must be
>> expected -- a finite type cannot represent an infinite precision number.
>
> The loss in precision should still be a warning. If I am using reals
> then I obviously needed a certain level of precision, I don't want to
> accidentally lose that precision somewhere because the compiler decided
> it was not important enough to warn me about it.

I disagree. I've used languages where converting floating point types is 
not implicit, and it's painful. Most of the time, the loss in precision 
isn't important.

-Steve


More information about the Digitalmars-d-learn mailing list