I'm getting NAN out of nowhere

Binarydepth via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 9 08:22:06 PDT 2015


On Thursday, 9 July 2015 at 15:18:18 UTC, Adam D. Ruppe wrote:
> On Thursday, 9 July 2015 at 15:14:43 UTC, Binarydepth wrote:
>> 	float prom;
>
> You didn't initialize this variable. Set it to 0.0 and it will 
> work.
>
> Like how pointers are initialized to null automatically in D, 
> floats are auto initalized to NaN in D. The idea is to make use 
> of an uninitialized variable obvious quickly so you are 
> encouraged to initialize it.

Thank you very much!! :D


More information about the Digitalmars-d-learn mailing list