• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    6
    ·
    6 months ago

    Well, that is what I meant. That NaN is effectively an error state. It’s only like null in that any float can be in this error state, because you can’t rule out this error state via the type system.

    Why do you feel like it’s not a great solution to make NaN an explicit error?

    • CapeWearingAeroplane@sopuli.xyz
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      Theres plenty of cases where I would like to do some large calculation that can potentially give a NaN at many intermediate steps. I prefer to check for the NaN at the end of the calculation, rather than have a bunch of checks in every intermediate step.

      How I handle the failed calculation is rarely dependent on which intermediate step gave a NaN.

      This feels like people want to take away a tool that makes development in the engineering world a whole lot easier because “null bad”, or because they can’t see the use of multiplying 1e27 with 1e-30.