Standard library / math/big
big.Rat.SetFrac64()
Set from signed 64-bit numerator and nonzero denominator, reducing to canonical form; zero denominator panics. This method writes to the receiver (use a separate destination to preserve inputs when needed). Expected stdout: '2/3\n'.
Formal Syntax & Structure
go syntaxgo
func (z *Rat) SetFrac64(a, b int64) *RatParameters & Attributes
| Name | Type | Description |
|---|---|---|
| a | int64 | Numerator. |
| b | int64 | Nonzero denominator. |
Return Value
*Rat
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(new(big.Rat).SetFrac64(12, 18))}