Skip to content

Commit 62857f8

Browse files
stevengjStefanKarpinski
authored andcommitted
link numeric literal coefficients from math operations manual (#32757)
1 parent 089cafc commit 62857f8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/src/manual/mathematical-operations.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ as well as the negation on [`Bool`](@ref) types:
2828
|:---------- |:-------- |:---------------------------------------- |
2929
| `!x` | negation | changes `true` to `false` and vice versa |
3030

31+
A numeric literal placed directly before an identifier or parentheses, e.g. `2x` or `2(x+y)`, is treated as a multiplication, except with higher precedence than other binary operations. See [Numeric Literal Coefficients](@ref man-numeric-literal-coefficients) for details.
32+
3133
Julia's promotion system makes arithmetic operations on mixtures of argument types "just work"
3234
naturally and automatically. See [Conversion and Promotion](@ref conversion-and-promotion) for details of the promotion
3335
system.
@@ -378,6 +380,8 @@ Julia applies the following order and associativity of operations, from highest
378380
For a complete list of *every* Julia operator's precedence, see the top of this file:
379381
[`src/julia-parser.scm`](https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm)
380382

383+
[Numeric literal coefficients](@ref man-numeric-literal-coefficients), e.g. `2x`, are treated as multiplications with higher precedence than any other binary operation, and also have higher precedence than `^`.
384+
381385
You can also find the numerical precedence for any given operator via the built-in function `Base.operator_precedence`, where higher numbers take precedence:
382386

383387
```jldoctest

0 commit comments

Comments
 (0)