Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:10:08+00:00 2026-06-01T03:10:08+00:00

I was taught that in maths we evaluate things, with the acronym BODMAS Brackets,

  • 0

I was taught that in maths we evaluate things, with the acronym BODMAS
Brackets, Orders(powers), Division, Multiplication, Addition, Subtraction.

I understand that in Javascript, * and / have equal precedence. + and - do too.
And left associativity is used.

From the few examples I can think of, it seems to work just as well, producing the same results as BODMAs.

It looks like in the reality of the mathematical rules, it doesn’t matter whether addition or subtraction is done first. It can matter whether additional or subtraction can done first 5-2+3. And for division and multiplication, it seems like it’s only an issue when division is left of multiplication like 9/3*4 then division must be done first. And Javascript does / first in that instance.

But maybe there is an example where it breaks it! Where it gives a different result to standard maths.

Can Javascript break logical mathematical rules?

UPDATE-

To answer myself, when in Mathematics one says, PEDMAS where D and M are equal precedence and done left to right. And ditto A and S. You are saying they’re left associative, i.e. where the implied brackets are. So programming languages that ‘implement PEDMAS’ the priority/precedence, and DM and AS being left associative, are totally following the PEDMAS rule. So, if there is any breaking of mathematical rules, it isn’t from the associativity of M,D,A,S which is the same as in (conventional) mathematics. Also, in Mathematics, the unary minus is here- PEUDMAS so -5^2=-(5^2)=-25. exponent takes priority over unary minus. Though javascript probably gets that right. Apparently floating points in javascript break rules, as shown in some answers, though that wasn’t what I had in mind as what I had in mind was purely re PEDMAS, but it seems parentheses make a difference with floating point numbers, where they shouldn’t in normal mathematics, as shown in the answer I accepted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:10:09+00:00Added an answer on June 1, 2026 at 3:10 am

    The only problem is with float numbers where the approximation of a division is extremely buggy. An actual example of this would be the fact that this will always alert false:

    var a = 0.1;
    var b = 0.2;
    var c = 0.3;
    if((a+b)+c == a+(b+c))
        alert("true");
    else
        alert("false");
    

    So basically the problem is with the Number object but not with the theoretical math implemented. As a programmer you probably understand the difference of the pre and post incrementation and the order of the operators so I do not really understand why did you gave as example 9/3*4 where the logic of the programmer applies and is verbose with the actual math.

    Finally the answer you seek ( probably just out of curiosity ) is that the actual logic of the math you know it has not been changed in JavaScript, just some bugs from the roots of this language which still haunts us today.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a question that I don't quite understand: The command, system(pause); is taught to
I was taught that a regression test was a small (only enough to prove
Inspired by the discussion in this question . We have all been taught that
My kindergarten SQL Server taught me that a trigger may be fired with multiple
I'm a self-taught developer and my experience is all in small applications that I've
It is taught in every computer science class and written in many books that
While refactoring code and ridding myself of all those #defines that we're now taught
I'm trying to learn this basic thing about processors that should be taught in
I've always been taught that if you are doing something to an object, that
I have always been taught that non-primitive types should be passed by const reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.