]> Cypherpunks repositories - gostls13.git/commitdiff
spec: fix constant expression example
authorRobert Griesemer <gri@golang.org>
Sat, 17 Nov 2012 19:16:07 +0000 (11:16 -0800)
committerRobert Griesemer <gri@golang.org>
Sat, 17 Nov 2012 19:16:07 +0000 (11:16 -0800)
Fixes #4400.

R=r, mirtchovski
CC=golang-dev
https://golang.org/cl/6782084

doc/go_spec.html

index c14d662f8b5e0a33e8917e10f76a327f140a56bd..73b65f5311b9d3962b4be14716eacea5301116c2 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of November 1, 2012",
+       "Subtitle": "Version of November 17, 2012",
        "Path": "/ref/spec"
 }-->
 
@@ -3656,7 +3656,8 @@ complex, or string constant).
 const a = 2 + 3.0          // a == 5.0   (untyped floating-point constant)
 const b = 15 / 4           // b == 3     (untyped integer constant)
 const c = 15 / 4.0         // c == 3.75  (untyped floating-point constant)
-const Θ float64 = 3/2      // Θ == 1.5   (type float64)
+const Θ float64 = 3/2      // Θ == 1.0   (type float64, 3/2 is integer division)
+const Π float64 = 3/2.     // Π == 1.5   (type float64, 3/2. is float division)
 const d = 1 &lt;&lt; 3.0         // d == 8     (untyped integer constant)
 const e = 1.0 &lt;&lt; 3         // e == 8     (untyped integer constant)
 const f = int32(1) &lt;&lt; 33   // f == 0     (type int32)