• furry toaster@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 hours ago

    what is the difference between an operator ane a function? is there any? one could argue that the common operators are just common useful functions and thus there is no reason why % is not one of them

    edit I thought you meant modulo operator not percent

    • asow8@mander.xyzOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 hours ago

      Yes, it was only after the comments mentioned modulo operator that I realized the % symbol has many meanings across different disciplines. I was coming from a chemistry perspective, and I should have specified from the beginning.

    • asow8@mander.xyzOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 hours ago

      Thank you for your comment! I had no idea what this meant, but I just looked it up. I will now be sure to use a non-breaking space from now on and look out for a number and its unit on different lines.

  • OhNoMoreLemmy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    42
    ·
    2 days ago

    I’m not being funny but it can be both.

    Square root is an operator that maps a number to the positive number that when squared returns the original number, but there is also a square root symbol.

    Similarly, % can be an operator that maps a number x to x/100, but there’s also a percent symbol.

    It just depends if you’re talking about functions or fonts.

    • JayleneSlide@lemmy.world
      link
      fedilink
      English
      arrow-up
      56
      ·
      2 days ago

      Let’s not forget that it’s also the symbol for modulo operation. So many opportunities for ambiguity!

        • martinborgen@piefed.social
          link
          fedilink
          English
          arrow-up
          4
          ·
          2 days ago

          At first glance I thought it was a joke about how programmers use modulo as an operator, while mathematicians use it as a relations thing. I never really understood the way the mathematicians use it tbh

    • asow8@mander.xyzOP
      link
      fedilink
      English
      arrow-up
      10
      ·
      2 days ago

      The difference between you and the people this meme is about is you understand that both space or no space are fine.

      For more context, I was trained to use a space between a number and its unit (e.g. 2 mol, 3 g, 1 M) for scientific writing. This includes the % sign when it follows a number (i.e. 100 %). So percent yields would be reported as 78 % instead of 78%. On the flip side, units that contain the % sign would not use a space. For example, mol% and wt% would not use a space to separate the % sign from the rest of the unit (i.e. 2 mol%).

      Since I was taught this from the very beginning of university, I never really questioned where the convention came from. Now, I work for a PI who does not use the space for %. Every time I write something (presentations, manuscripts, etc.), they clarify that % is a mathematical operator so there is no space. After a search to defend my position, I found the SI brochure from the Bureau International des Poids et Mesures that clearly states the use of a space.

      Recently in group meeting, while talking about something kind of related to units, they said that I believe there should be a space for %. I quickly clarified (and showed the SI brochure as evidence) that I do not “believe” there should be a space; this isn’t something I have created in my mind. Finally, they said that since it is their lab any manuscripts must follow their convention. Now when I write, I write my way and change it when I self edit before sending it to my PI.

      • wiase@discuss.online
        link
        fedilink
        English
        arrow-up
        2
        ·
        14 hours ago

        I was taught the same thing at uni (chemistry) but almost all journals in my field of work (toxicology) use no space.

      • flyos@jlai.lu
        link
        fedilink
        English
        arrow-up
        12
        ·
        2 days ago

        The “it’s my lab, so you follow my conventions” for a thing a silly as the space before % (and after you’ve used a rightful source to stand your point) is a very dumb power move IMO.

    • Quibblekrust
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      2
      ·
      edit-2
      1 day ago

      Square root is an operator that maps a number to the positive number that when squared returns the original number

      Nah, dog. You’re arbitrarily ignoring negatives. The square root of 4 is ±2.

      Nah, dog. I’m wrong

      • definitemaybe@lemmy.ca
        link
        fedilink
        English
        arrow-up
        9
        ·
        edit-2
        2 days ago

        I assume you’re nerd baiting* with that, but it’s infuriating how many math teachers actually teach that.

        It’s not that complicated. x² = n isn’t the same thing as x = √2 because then square rooting isn’t a function, which is asinine. (Similarly to why 0! isn’t defined to be 0, because otherwise it’s a stupid notation that would need a piecewise function definition for just about every single application of the factorial function.)

        *link to xkcd: Duty Calls

        Edit: my phone autocorrected “isn’t” to “is”, lol.

        • Quibblekrust
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 day ago

          x² = n isn’t the same thing as x = √2

          I guess that’s what I was thinking. I don’t think I can even blame my math teachers.

      • jeff 👨‍💻@programming.dev
        link
        fedilink
        English
        arrow-up
        9
        ·
        2 days ago

        You are misunderstanding what the remainder is.

        5 % 2 == 1, because 5 == 2 x 2 + 1

        10 % 7 == 3, because 10 == 1 x 7 + 3

        Your “edit 2” is mostly correct. I don’t think of it “undoing” the division. But if that makes sense to you then I guess it’s fine

      • Rivalarrival@lemmy.today
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 days ago

        Modulo is much easier to understand with clocks.

        Suppose It is currently midnight. What time will it be in 3 hours? 3 mod 24 = 3. It will be 03:00

        What time will it be in 27 hours? 27 mod 24 = 3. We go through a whole day (24 hours) to get back to midnight, then continue another 3 hours, for a total of 27. The time will be 03:00.

        What time will it be 48 hours from now? 48 mod 24 = 0. 48 hours from midnight will be midnight.

        What time will it be 6 hours from now? 6 mod 24 = 6.

        Conceptually, X mod Y means that instead of 24 hours per day, we are splitting the day into Y “hours”, labeled 0 to Y-1. We start at 0, and pass through X “hours”. X mod Y is the “hour” we finish up in at the end. 5 mod 2 means we have a 2-hour day, with hours 0 and 1. We pass through 5 of those hours. When we finish, are we at hour 0 or hour 1?

      • chaos@beehaw.org
        link
        fedilink
        English
        arrow-up
        5
        ·
        2 days ago

        It’s not undoing the division, it never happens in the first place. Remainders aren’t ever fractions, that’s the whole point, they’re left over because they can’t be divided evenly. 5 % 2, you can take 2 away twice and you’ll have 1 left over which can’t have 2 taken away.

        • bryndos@fedia.io
          link
          fedilink
          arrow-up
          6
          ·
          2 days ago

          % is used in C and various other programming as the modulo “operator”. DDG calculator does explain itself by restating the input to mod(5,2).

          Computer programmers are just lazy and will steal any commonly understood symbol and reporpoise it to save a few key strokes.

    • anton@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      And since it’s a function with one argument we can interpret the exponent to mean repeated application.
      xm³=x(1 meter)(1 meter)(1 meter)
      xm³=x(1 meter)³
      It all checks out.