Standard library / math/big

big.Int.Exp()

Computes integer exponentiation, optionally modulo |m|; negative modular exponent needs an inverse. Not a constant-time cryptographic primitive. Expected stdout: '1208925819614629174706176\n'.

Formal Syntax & Structure

go syntaxgo
func (z *Int) Exp(x, y, m *Int) *Int

Parameters & Attributes

NameTypeDescription
x*IntFirst input operand (or sole input if unary).
y*IntSecond input operand.
m*IntInput m; see the operation contract.

Return Value

*Int

Computes integer exponentiation, optionally modulo |m|; negative modular exponent needs an inverse. Not a constant-time cryptographic primitive.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/big")
func main() {  fmt.Println(new(big.Int).Exp(big.NewInt(2), big.NewInt(80), nil))}
Go Reference