Movement against float.init being nan
Salih Dincer
salihdb at hotmail.com
Mon Aug 22 01:09:53 UTC 2022
On Saturday, 20 August 2022 at 21:07:33 UTC, Bastiaan Veelo wrote:
> ```d
> import std;
>
> alias Distance = Typedef!(double, 0.0, "distance");
> alias Temperature = Typedef!(double, 0.0, "temperature");
>
> void main()
> {
> Temperature t;
> Distance d;
> d += 4.5;
> // t = d; // does not compile
> }
> ```
> However, type information can get lost in intermediate results:
> ```d
> t = 0.5 + d; // result is double
> ```
It's very simple and beautiful. Thank you, very delicious!
SDB at 79
More information about the Digitalmars-d
mailing list