Change-Id: Ibef5f96ea588d17eac1c96ee3992e01943ba0fef
Reviewed-on: https://go-review.googlesource.com/131496
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
fmt.Printf("%.1f", c)
// Output: 100.0
}
+
+func ExampleRound() {
+ p := math.Round(10.5)
+ fmt.Printf("%.1f\n", p)
+
+ n := math.Round(-10.5)
+ fmt.Printf("%.1f\n", n)
+ // Output:
+ // 11.0
+ // -11.0
+}
+
+func ExampleRoundToEven() {
+ u := math.RoundToEven(11.5)
+ fmt.Printf("%.1f\n", u)
+
+ d := math.RoundToEven(12.5)
+ fmt.Printf("%.1f\n", d)
+ // Output:
+ // 12.0
+ // 12.0
+}