This is an old version, view current version.

## 3.6 Real-Valued Arithmetic Operators

The arithmetic operators are presented using C++ notation. For instance operator+(x,y) refers to the binary addition operator and operator-(x) to the unary negation operator. In Stan programs, these are written using the usual infix and prefix notations as x + y and -x, respectively.

### 3.6.1 Binary Infix Operators

real operator+(real x, real y)
Return the sum of x and y. $(x + y) = \text{operator+}(x,y) = x+y$

real operator-(real x, real y)
Return the difference between x and y. $(x - y) = \text{operator-}(x,y) = x - y$

real operator*(real x, real y)
Return the product of x and y. $(x * y) = \text{operator*}(x,y) = xy$

real operator/(real x, real y)
Return the quotient of x and y. $(x / y) = \text{operator/}(x,y) = \frac{x}{y}$

real operator^(real x, real y)
Return x raised to the power of y. $(x^\mathrm{\wedge}y) = \text{operator}^\mathrm{\wedge}(x,y) = x^y$

### 3.6.2 Unary Prefix Operators

real operator-(real x)
Return the negation of the subtrahend x. $\text{operator-}(x) = (-x)$

real operator+(real x)
Return the value of x. $\text{operator+}(x) = x$