floats default to NaN... why?
F i L
witte2008 at gmail.com
Sat Apr 14 11:07:27 PDT 2012
On Saturday, 14 April 2012 at 18:02:57 UTC, Andrej Mitrovic wrote:
> On 4/14/12, F i L <witte2008 at gmail.com> wrote:
>> auto f = 1.0f; // is float not Float
>
> UFCS in 2.059 to the rescue:
>
> struct Float
> {
> float payload = 0.0;
> alias payload this;
> }
>
> @property Float f(float val) { return Float(val); }
>
> void main()
> {
> auto f = 1.0.f;
> }
You're a scholar and and gentlemen!
More information about the Digitalmars-d-learn
mailing list