Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify precedence of numeric literal coefs over parenthesis #21800

Merged
merged 3 commits into from
Nov 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/src/manual/integers-and-floating-point-numbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ Numeric literals also work as coefficients to parenthesized expressions:
julia> 2(x-1)^2 - 3(x-1) + 1
3
```
!!! note
The precedence of numeric literal coefficients used for implicit
multiplication is higher than other binary operators such as multiplication
(`*`), and division (`/`, `\`, and `//`). This means, for example, that
`1 / 2im` equals `-0.5im` and `6 // 2(2 + 1)` equals `1 // 1`.

Additionally, parenthesized expressions can be used as coefficients to variables, implying multiplication
of the expression by the variable:
Expand Down