I'm getting NAN out of nowhere

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 9 08:18:17 PDT 2015


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.


More information about the Digitalmars-d-learn mailing list