Standard library / math/big
big.Rat
Exact reduced rational; denominator nonzero. Use Set for independent copies. Expected stdout: '1/3\n'.
Formal Syntax & Structure
go syntaxgo
type Rat struct { /* unexported fields */ }Working Example
Example Snippetgo
package main
import ( "fmt" "math/big")
func main() { var v big.Rat v.SetFrac64(2, 6) fmt.Println(&v)}