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

bauss jj_1337 at live.dk
Thu Jul 8 16:09:50 UTC 2021


On Wednesday, 30 June 2021 at 16:19:35 UTC, someone wrote:
> On Wednesday, 30 June 2021 at 10:38:05 UTC, jmh530 wrote:
>
>> You've never given something away for free?
>
> ... more often than usual LoL
>
> Now, seriously, something for free has not a price = 0, it has 
> NO price, that's what null is for; we use zero for the lack of 
> null.

Actually a price can be 0, say if you have a sale that gives 100 
% off then the price doesn’t magically disappear. It could be 
that the 100 % off is only for specific people or businesses. Or 
that they pay fees instead of the price of a product, in which 
case there’s a fee price but a product with the price of 0 
because otherwise you’ll have accounting problems since you can’t 
make accounting on records without prices, because mathematically 
that makes no sense.


More information about the Digitalmars-d-learn mailing list