float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

someone someone at somewhere.com
Wed Jun 30 04:03:24 UTC 2021


On Wednesday, 30 June 2021 at 03:51:47 UTC, Mathias LANG wrote:

> or use `std.math.isNaN`.

```d
import std.math : isNaN;

float lnumStockPricePreceding;

foreach (float lnumStockPrice; ludtStockPriceEvolution.range)

    if (! isNan(lnumStockPricePreceding)) {

       /// do something

    }

    lnumStockPricePreceding = lnumStockPrice;

}
```

... is far from pretty but it works as expected, thanks for your 
tip !


More information about the Digitalmars-d-learn mailing list