Standard library / math/big

big.Rat.IsInt()

Report whether the normalized denominator equals one. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Rat) IsInt() bool

Return Value

bool

Returns the result described above; see the example for the observed behavior.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(big.NewRat(6, 3).IsInt(), big.NewRat(1, 3).IsInt())}
Go Reference