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

The New Math

lemmy.ml

message-square
10
fedilink
44

The New Math

lemmy.ml

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

    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 年前

    …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 年前

      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 年前

        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 年前

          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 年前

    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 年前

    Javascript in a nutshell

  • AgreeableLandscape@lemmy.mlM
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    3 年前

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

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      3 年前

      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 年前

    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.

  • 16 users / day
  • 710 users / week
  • 1.84K users / month
  • 7.4K users / 6 months
  • 42 local subscribers
  • 38.7K subscribers
  • 2.01K Posts
  • 38.6K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.6
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org