Mod in Go

Posted by GoDoc
Public (Editable by Users)

Mod returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.

Go
Edit
package main

import (
	"fmt"
	"math"
)

func main() {
	c := math.Mod(7, 4)
	fmt.Printf("%.1f", c)
}