From fcb45e7ceff09548eb0308909256296086eedf9c Mon Sep 17 00:00:00 2001
From: Terrel Shumway int64
.
Prior to Go 1.1, the 64-bit Go compilers (both gc and gccgo) used
a 32-bit representation for int
. As of Go 1.1 they use
a 64-bit representation.
+
On the other hand, floating-point scalars and complex
-numbers are always sized: float32
, complex64
,
-etc., because programmers should be aware of precision when using
-floating-point numbers.
-The default size of a floating-point constant is float64
.
+types are always sized (there are no float
or complex
basic types),
+because programmers should be aware of precision when using floating-point numbers.
+The default type used for an (untyped) floating-point constant is float64
.
+Thus foo := 3.0
declares a variable foo
of type float64
.
+For a float32
variable initialized by a constant, the variable type must be specified explicitly
+in the variable declaration var foo float32 = 3.0
, or the constant must be given a
+type with a conversion as in foo := float32(3.0)
.