Standard library / go/constant

go/constant.Denom()

Return a positive integer denominator for a real numeric constant, or Unknown if a supported fraction cannot be represented. Expected stdout: '10\n'.

Formal Syntax & Structure

go syntaxgo
func Denom(x Value) Value

Parameters & Attributes

NameTypeDescription
xValueInput constant or Go value as specified by the function.

Return Value

Value

Return a positive integer denominator for a real numeric constant, or Unknown if a supported fraction cannot be represented.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/constant"  "go/token")
func main() { fmt.Println(constant.Denom(constant.MakeFromLiteral("0.1", token.FLOAT, 0))) }
Go Reference