Hello, here is a list of the order of precedence for computations when programming, at least in MATLAB(adsbygoogle = window.adsbygoogle || []).push({});

1. Parentheses (starting with innermost pair)

2. NOT (~) (left to right)

3. Arithmetic operations (left to right)

4. Relational operations (left to right)

5. AND (&)

6. OR (|)

7. Short-circuit AND (&&)

8. Short-circuit OR (||)

I was wondering if there is any rhyme or reason for this order, or is it just something that I need to have committed to memory?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [Matlab] Order of precedence in computations

Tags:

Loading...

Similar Threads - Matlab Order precedence | Date |
---|---|

Matlab Simulink: designing a 2nd order sliding controller | Jul 5, 2017 |

Matlab help - 2nd order ODE | Mar 12, 2015 |

Coupled 1st order differential equations in matlab | May 1, 2014 |

How to simulate 2nd order markov chain (if poss. Nth order) in MATLAB | May 10, 2013 |

Is there any package to add to MATLAB to make it better at higher order arithmetic? | Jul 25, 2012 |

**Physics Forums - The Fusion of Science and Community**