from Hacker News

Math4devs.com: List of mathematical symbols with their JavaScript equivalent

by fagnerbrack on 11/19/24, 9:01 PM with 12 comments

  • by shireboy on 11/19/24, 11:44 PM

    This is pretty cool. As a self-taught developer with a non-CS major, my math limited out at college algebra 2. I recently did Brilliant.org calculus just to try to make better sense of various CS papers, and I thought at the time I could probably understand some of the concepts in code better than standard mathematics notation. Something like this definitely helps me understand the math symbols better. I could see taking it to the next level and adding other languages and symbols.
  • by joeframbach on 11/21/24, 3:34 PM

    1. Floor operator is `⌊n⌋`.

    2. Exponentiation implementation depends on the size of the power. For very small powers normally they are represented as their reciprocal, then operated on within the exponent.

        y = b ** (1/x)
    
    
    for very large x is rewritten as

        y = Math.exp(Math.log(b) / x)
  • by Rendello on 11/19/24, 11:09 PM

    I like this a lot. I've been going through HS-level math with Math Academy and I'm always intrigued when I see these symbols in advanced calculations elsewhere online.

    I recently learned the syntax for half-open intervals. It's so frustrating that I can't bear to type it out. This is relevant: https://xkcd.com/859/

  • by sxp on 11/19/24, 11:21 PM

    Do programmers use those weird font ligatures in practice? E.g, Rendering `a != b` as `a≠b`. I've only seen them used by people who want to show how far they can push coding style away from the standard monospace low ASCII, but haven't seen any good justification for them.