szmer
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.ml · 3 years ago

The New Math

lemmy.ml

message-square
10
fedilink
44

The New Math

lemmy.ml

☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.ml · 3 years ago
message-square
10
fedilink
alert-triangle
You must log in or # to comment.
  • JPAKx4@lemmy.sdf.org
    link
    fedilink
    arrow-up
    6
    ·
    2 years ago

    And it works properly if you change it from a float to a strong first! JavaScript 🥰

  • Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    3 years ago

    …but why? This looks like it would never be expected behavior. Like a bug in the implementation, which can simply be fixed.

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      10
      ·
      3 years ago

      Oh no, it’s even documented on MDN:

      Screenshot showing code examples where all kinds of numbers are being converted to 4 or to 1.

      https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#using_parseint

      • enebe@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        Sweet Flying Spaghetti Monster, that’s horrible. I’m guessing the reason is to keep the truth value equivalent when casting to boolean, but there has to be a more elegant way…

        • Ephera@lemmy.ml
          link
          fedilink
          arrow-up
          2
          ·
          3 years ago

          Might be, but this is also a decent explanation: https://lemmy.ml/post/464637/comment/272066

  • brombek@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    3 years ago

    It amazes me that people write financial software in JS. What can possibly go wrong :D

  • thervingi@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    3 years ago

    Javascript in a nutshell

  • AgreeableLandscape@lemmy.mlM
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    3 years ago

    Technically, the top and bottom lines on classical math approach 1 and 0, like limits.

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

      As far as I’m aware, there’s actually no consensus on what’s technically correct.

      Some will argue that they don’t approach these values, because you’re not saying lim x from 0 to ∞, where x is the number of '9'-digits. Instead, you’re saying that the number of digits is already infinite right now.

  • Arthur Besse@lemmy.ml
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    3 years ago

    2**53 + 1 == 2**53

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 312 users / day
  • 788 users / week
  • 1.74K users / month
  • 9.6K users / 6 months
  • 42 local subscribers
  • 35.6K subscribers
  • 1.83K Posts
  • 36.6K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.6
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org