Skip to content

Commit 99805a3

Browse files
authored
Added x^-y clarification in Base.^ docs (#38295)
1 parent 6e88e31 commit 99805a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

base/promotion.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ If `y` is an `Int` literal (e.g. `2` in `x^2` or `-3` in `x^-3`), the Julia code
333333
enable compile-time specialization on the value of the exponent.
334334
(As a default fallback we have `Base.literal_pow(^, x, Val(y)) = ^(x,y)`,
335335
where usually `^ == Base.^` unless `^` has been defined in the calling
336-
namespace.)
336+
namespace.) If `y` is a negative integer literal, then `Base.literal_pow`
337+
transforms the operation to `inv(x)^y` by default.
338+
337339
338340
```jldoctest
339341
julia> 3^5

0 commit comments

Comments
 (0)