Standard library / math/big

big.Float.IsInt()

Report whether a finite Float has no fractional part; infinity is not an integer. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Float) 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.NewFloat(4).IsInt(), big.NewFloat(4.5).IsInt())}
Go Reference