]> Cypherpunks repositories - gostls13.git/commitdiff
math: add Remainder example
authorPedro Lopez Mareque <pedro.lopez.mareque@gmail.com>
Sat, 2 Oct 2021 09:59:08 +0000 (11:59 +0200)
committerRobert Griesemer <gri@golang.org>
Thu, 7 Oct 2021 18:09:53 +0000 (18:09 +0000)
Change-Id: I4b0fa69a36b04103473aa08e246fa193315ac5aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/353689
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/math/example_test.go

index 9fc196796796c9ac1c1406a53242741fc207284d..a26d8cbe97d8b463cbcb1ea6e57197545a253dbc 100644 (file)
@@ -162,6 +162,11 @@ func ExampleLog10() {
        // Output: 2.0
 }
 
+func ExampleRemainder() {
+       fmt.Printf("%.1f", math.Remainder(100, 30))
+       // Output: 10.0
+}
+
 func ExampleMod() {
        c := math.Mod(7, 4)
        fmt.Printf("%.1f", c)