Skip to content

Commit e0af9ad

Browse files
robertfeldtXnartharax
authored andcommitted
doc: clarify that the unsigned type is promoted to (JuliaLang#48973)
Clarify that the unsigned type is promoted to, if the types differ only in signedness. This choice was explained by Karpinski in JuliaLang#9292 (comment) but wasn't fully clear in the documentation.
1 parent 1254254 commit e0af9ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/src/manual/conversion-and-promotion.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ julia> promote(1 + 2im, 3//4)
233233
```
234234

235235
Floating-point values are promoted to the largest of the floating-point argument types. Integer
236-
values are promoted to the larger of either the native machine word size or the largest integer
237-
argument type. Mixtures of integers and floating-point values are promoted to a floating-point
238-
type big enough to hold all the values. Integers mixed with rationals are promoted to rationals.
239-
Rationals mixed with floats are promoted to floats. Complex values mixed with real values are
240-
promoted to the appropriate kind of complex value.
236+
values are promoted to the largest of the integer argument types. If the types are the same size
237+
but differ in signedness, the unsigned type is chosen. Mixtures of integers and floating-point
238+
values are promoted to a floating-point type big enough to hold all the values. Integers mixed
239+
with rationals are promoted to rationals. Rationals mixed with floats are promoted to floats.
240+
Complex values mixed with real values are promoted to the appropriate kind of complex value.
241241

242242
That is really all there is to using promotions. The rest is just a matter of clever application,
243243
the most typical "clever" application being the definition of catch-all methods for numeric operations

0 commit comments

Comments
 (0)