From: Robert Griesemer
-A numeric type represents sets of integer or floating-point values.
+An integer, floating-point, or complex type
+represents the set of integer, floating-point, or complex values, respectively.
+They are collectively called numeric types.
The predeclared architecture-independent numeric types are:
Numeric types
-There is also a set of predeclared numeric types with implementation-specific sizes: +There is also a set of predeclared integer types with implementation-specific sizes:
@@ -1921,7 +1923,7 @@ if one of the following conditions applies:
T
is a floating-point type and x
can be rounded to T
's
+T
is a floating-point type and x
can be rounded to T
's
precision without overflow. Rounding uses IEEE 754 round-to-even rules but with an IEEE
negative zero further simplified to an unsigned zero. Note that constant values never result
in an IEEE negative zero, NaN, or infinity.
@@ -3108,7 +3110,7 @@ For array and slice literals the following rules apply:
key must be a non-negative constant
representable by
a value of type int
; and if it is typed
- it must be of integer type.
+ it must be of integer type.
a
is not a map:
x
must be of integer type or an untyped constantx
must be of integer type or an untyped constantint
int
-The right operand in a shift expression must have integer type
+The right operand in a shift expression must have integer type
or be an untyped constant representable by a
value of type uint
.
If the left operand of a non-constant shift expression is an untyped constant,
@@ -4740,8 +4742,9 @@ x == y+1 && <-chanInt > 0
Arithmetic operators apply to numeric values and yield a result of the same
type as the first operand. The four standard arithmetic operators (+
,
--
, *
, /
) apply to integer,
-floating-point, and complex types; +
also applies to strings.
+-
, *
, /
) apply to
+integer, floating-point, and
+complex types; +
also applies to strings
@@ -4880,7 +4883,7 @@ occurs is implementation-specific.
An implementation may combine multiple floating-point operations into a single
fused operation, possibly across statements, and produce a result that differs
from the value obtained by executing and rounding the instructions individually.
-An explicit floating-point type conversion rounds to
+An explicit floating-point type conversion rounds to
the precision of the target type, preventing fusion that would discard that rounding.
v := uint16(0x10F0)
, then uint32(int8(v)) == 0xFFFFFFF0
.
The conversion always yields a valid value; there is no indication of overflow.
x
of type float32
may be stored using additional precision beyond that of an IEEE-754 32-bit number,
@@ -7037,7 +7040,7 @@ make(T, n) channel buffered channel of type T, buffer size n
-Each of the size arguments n
and m
must be of integer type
+Each of the size arguments n
and m
must be of integer type
or an untyped constant.
A constant size argument must be non-negative and representable
by a value of type int
; if it is an untyped constant it is given type int
.
@@ -7182,7 +7185,8 @@ imag(complexT) floatT
The type of the arguments and return value correspond.
For complex
, the two arguments must be of the same
-floating-point type and the return type is the complex type
+floating-point type and the return type is the
+complex type
with the corresponding floating-point constituents:
complex64
for float32
arguments, and
complex128
for float64
arguments.
@@ -7897,7 +7901,7 @@ of constant size.
The function Add
adds len
to ptr
and returns the updated pointer unsafe.Pointer(uintptr(ptr) + uintptr(len))
.
-The len
argument must be of integer type or an untyped constant.
+The len
argument must be of integer type or an untyped constant.
A constant len
argument must be representable by a value of type int
;
if it is an untyped constant it is given type int
.
The rules for valid uses of Pointer
still apply.
@@ -7920,7 +7924,7 @@ is nil
and len
is zero,
-The len
argument must be of integer type or an untyped constant.
+The len
argument must be of integer type or an untyped constant.
A constant len
argument must be non-negative and representable by a value of type int
;
if it is an untyped constant it is given type int
.
At run time, if len
is negative,