Jump to content

Recommended Posts

Parentheses

  • Parentheses are used for groupings exactly as they would be in traditional mathematics.
  • For example, take this equation line: R/(a*2)
  • By putting a*2 in parentheses, it will be evaluated first before being divided by R.

The statement as written describes the following (a*2)/R, that incidentally does not need parenthesis as multiplication and division have the same priority and the left to right rule applies.  

The words in Bold are incorrect.  The example R/(a*2) has a*2 calculated first and then divided into R.

 

Share this post


Link to post
Share on other sites

Seriously, I don't think this is necessarily a mistake as even though multiplication and division have the same precedence, one can still use parenthesis to make it clear to the user the order of execution and for readability purposes.  This is a very common practice in programming.

Share this post


Link to post
Share on other sites
13 hours ago, p_mac said:

By putting a*2 in parentheses, it will be evaluated first before being divided by R.

Agreed, that does not look correct


Due to the ongoing Brexit negotiations, punctuation, spelling and grammar will be used sparingly until further notice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×