Skip to content

Commit

Permalink
math: add examples to Ceil, Floor, Pow, Pow10 functions
Browse files Browse the repository at this point in the history
Change-Id: I9154df128b349c102854bb0f21e4c313685dd0e6
Reviewed-on: https://go-review.googlesource.com/118659
Reviewed-by: Brad Fitzpatrick <[email protected]>
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
andriisoldatenko authored and bradfitz committed Jun 13, 2018
1 parent a7d8957 commit efddc16
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/math/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,27 @@ func ExampleSqrt() {
fmt.Printf("%.1f", c)
// Output: 5.0
}

func ExampleCeil() {
c := math.Ceil(1.49)
fmt.Printf("%.1f", c)
// Output: 2.0
}

func ExampleFloor() {
c := math.Floor(1.51)
fmt.Printf("%.1f", c)
// Output: 1.0
}

func ExamplePow() {
c := math.Pow(2, 3)
fmt.Printf("%.1f", c)
// Output: 8.0
}

func ExamplePow10() {
c := math.Pow10(2)
fmt.Printf("%.1f", c)
// Output: 100.0
}

0 comments on commit efddc16

Please sign in to comment.