News for hackers. Stuff that matters.
Re:Is it time to stop using sentinel values for null / “NA” ... by cratermoon on Monday June 05, 2023 @12:02PM (#36198305)
However, if you define a "null" number as 0, the summation works fine. Division by 0 can still fail, and that's good because the naïve coder will get a result like NaN or, in some languages, undefined behavior, alerting them to the problem.
Re:Is it time to stop using sentinel values for null / “NA” ... by arthurjj on Monday June 05, 2023 @12:55PM (#36199228)
>the summation works fine

This is only true if that summation is not used or compared anywhere else which isn't usually the case. For example if in sql you are reporting the SUM(column_A)/ SUM(column_B) and one column can be null without the other one being null you're likely reporting the wrong number

Re:Is it time to stop using sentinel values for null / “NA” ... by cratermoon on Monday June 05, 2023 @12:57PM (#36199271)
So you're saying if you don't consistently use the same value to represent the value, you get incorrect results?