• OT: Parsing of mathematical expression

    From NY@me@privacy.invalid to uk.tech.digital-tv on Tue Jan 13 12:29:19 2026
    From Newsgroup: uk.tech.digital-tv

    An expression written as 3# -(-3#) (that's 3^2 - (-3^2) in case the superscript two doesn't reproduce) would be parsed as 3# - (-(3#)) = 9 -
    (-9) = 18, and not as 3# - (-3)# = 9 - 9 = 0, wouldn't it?

    Stupid to write the expression in a way that even *might* be ambiguous to people who didn't know the BODMAS rules, and I'd always use brackets, even
    if they were superfluous, to make my meaning obvious, but given the
    expression as it was written, I've evaluated it correctly, haven't I?

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Andy Burns@usenet@andyburns.uk to uk.tech.digital-tv on Tue Jan 13 14:03:41 2026
    From Newsgroup: uk.tech.digital-tv

    NY wrote:

    An expression written as 3-# -(-3-#) (that's 3^2 - (-3^2)-a in case the superscript two doesn't reproduce) would be parsed as 3-# - (-(3-#)) = 9 - (-9) = 18, and not as 3-# - (-3)-# = 9 - 9 = 0, wouldn't it?

    Stupid to write the expression in a way that even *might* be ambiguous
    to people who didn't know the BODMAS rules, and I'd always use brackets, even if they were superfluous, to make my meaning obvious, but given the expression as it was written, I've evaluated it correctly, haven't I?

    I'd read it as (three squared) minus (negativethree squared)

    you're implying a hidden zero?

    like (three squared) minus (zero minus (three squared))



    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Java Jive@java@evij.com.invalid to uk.tech.digital-tv on Tue Jan 13 14:14:05 2026
    From Newsgroup: uk.tech.digital-tv

    On 2026-01-13 12:29, NY wrote:

    An expression written as 3-# -(-3-#) (that's 3^2 - (-3^2)-a in case the superscript two doesn't reproduce) would be parsed as 3-# - (-(3-#)) = 9 - (-9) = 18, and not as 3-# - (-3)-# = 9 - 9 = 0, wouldn't it?

    Yes. Given how what you've posted is displayed in Thunderbird ...

    B = evaluate the bracketed expression first, that is -3-#
    O = evaluate the orders/powers next, that is 3-# = 9

    So the bracketed expression comes to -9.

    Then - times - = +, giving 9 + 9 = 18 for the whole expression.
    --

    Fake news kills!

    I may be contacted via the contact address given on my website: www.macfh.co.uk

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From richard@richard@cogsci.ed.ac.uk (Richard Tobin) to uk.tech.digital-tv on Tue Jan 13 14:25:31 2026
    From Newsgroup: uk.tech.digital-tv

    In article <10k5drq$34c9o$1@dont-email.me>, NY <me@privacy.invalid> wrote:
    An expression written as 3# -(-3#) (that's 3^2 - (-3^2) in case the >superscript two doesn't reproduce) would be parsed as 3# - (-(3#)) = 9 - >(-9) = 18, and not as 3# - (-3)# = 9 - 9 = 0, wouldn't it?

    Stupid to write the expression in a way that even *might* be ambiguous to >people who didn't know the BODMAS rules, and I'd always use brackets, even >if they were superfluous, to make my meaning obvious, but given the >expression as it was written, I've evaluated it correctly, haven't I?

    If you're talking about human communication, I don't think there is a "correctly". In a computer language there will be precise rules, and schoolteachers will tell you that there is a rigid convention, but in
    real life the correct approach is to ask the writer to clarify it.

    The spacing in your first expression might even suggest that it's
    three-squared times minus-something.

    -- Richard
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Jeff Layman@Jeff@invalid.invalid to uk.tech.digital-tv on Tue Jan 13 14:40:51 2026
    From Newsgroup: uk.tech.digital-tv

    On 13/01/2026 12:29, NY wrote:
    An expression written as 3-# -(-3-#) (that's 3^2 - (-3^2) in case the superscript two doesn't reproduce) would be parsed as 3-# - (-(3-#)) = 9 - (-9) = 18, and not as 3-# - (-3)-# = 9 - 9 = 0, wouldn't it?

    Stupid to write the expression in a way that even *might* be ambiguous to people who didn't know the BODMAS rules, and I'd always use brackets, even
    if they were superfluous, to make my meaning obvious, but given the expression as it was written, I've evaluated it correctly, haven't I?

    I hadn't seen the "Unary" rule, but it can lead to confusion: <https://en.wikipedia.org/wiki/Order_of_operations#Unary_minus_sign>
    --
    Jeff
    --- Synchronet 3.21a-Linux NewsLink 1.2