Skip to content

math/big: Int.Exp returns ±1 whenever the exponent is <= 0 #4239

@remyoudompheng

Description

@remyoudompheng
What steps will reproduce the problem?
1. Run

package main

import (
    "fmt"
    "math/big"
)

func main() {
    var z big.Int
    z.Exp(big.NewInt(-2), big.NewInt(0), nil)
    fmt.Println(&z)
}

What is the expected output? What do you see instead?

Expected: 1
Got: -1

Please use labels and text to provide additional information.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions