Standard library / math
math.Mod()
Floating-point remainder with quotient truncated toward zero; sign follows dividend. Expected stdout: '-3\n'.
Formal Syntax & Structure
go syntaxgo
func Mod(x, y float64) float64Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | float64 | First input operand (or sole input if unary). |
| y | float64 | Second input operand. |
Return Value
float64
Floating-point remainder with quotient truncated toward zero; sign follows dividend.
Working Example
Example Snippetgo
package main
import ( "fmt" "math")
func main() { fmt.Println(math.Mod(-7, 4))}