On Wednesday, 30 June 2021 at 03:32:27 UTC, Vladimir Panteleev wrote:
> Comparison with nan
always results in false
:
THAT explains a lot !
> See section 10.11.5:
missed it.
One of the things I do not like with D, and it causes me to shoot me on the foot over and over, is the lack of null for every data type. Things like:
float lnumStockPricePreceding = null;
foreach (float lnumStockPrice; ludtStockPriceEvolution.range)
if (lnumStockPricePreceding ! is null) {
/// do something
}
lnumStockPricePreceding = lnumStockPrice;
}
... were first attempted like following on D:
float lnumStockPricePreceding;
foreach (float lnumStockPrice; ludtStockPriceEvolution.range)
if (lnumStockPricePreceding != float.nan) {
/// do something
}
lnumStockPricePreceding = lnumStockPrice;
}
... and now need to be recoded like:
float lnumStockPricePreceding = 0f;
foreach (float lnumStockPrice; ludtStockPriceEvolution.range)
if (lnumStockPricePreceding != 0f) {
/// do something
}
lnumStockPricePreceding = lnumStockPrice;
}
... which oftenly complicates things because sometimes even 0f is a valid value for the task at hand and thus I MISS NULLs A LOT :( ... at least I can do nulls with strings since it a class :)