• shilangyu (lemmur)@lemmy.ml
    link
    fedilink
    arrow-up
    13
    ·
    edit-2
    3 years ago

    I’m so bored of people bringing up NaN !== NaN when talking about “javascript’s wonkiness”. This is defined by IEEE for the floating point standard and it appears any other language using IEEE 754 (which is the majority)

    • handvat@lemmy.ml
      link
      fedilink
      arrow-up
      5
      ·
      3 years ago

      You shouldn’t attempt comparing 2 floating point numbers with simply == (or === in JavaScript) in most cases and in most languages anyways.

    • spytfyre@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      3 years ago

      Totally agree. Moreover I can not think of a valid scenario where you would use such a comparison