• Statick@programming.dev
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    15 hours ago

    I think they’re pointing out that Python outputs E notation vs JavaScript which outputs the decimal notation.

    Edit: Wasn’t agreeing with it, just explaining what they were pointing out.

    • Korne127@lemmy.world
      link
      fedilink
      arrow-up
      22
      ·
      21 hours ago

      Yeah, but that… doesn’t really matter. So it doesn’t really make sense to post that here, especially with that headline.

    • paequ2@lemmy.today
      link
      fedilink
      English
      arrow-up
      11
      ·
      edit-2
      21 hours ago

      Would this cause a problem? I’m assuming this would be deserialized to the same value, no?

    • towerful@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      17 hours ago

      But that’s a stringify method, tho.
      JS passes a float to the console. Console prints the float however it wants to.

      Just do strict comparison when you want to compare a variable to1e-5.
      Cause a string of 0.00001 should be passed through parseFloat (or whatever your language equivalent is) before you compare it to a variable with the value f0.00001