Skip to content

math/big: incorrect string->Float conversion or printing for literals with large exponent #11341

Closed
@griesemer

Description

@griesemer
package main

import (
    "fmt"
    "math/big"
)

func main() {
    var x big.Float
    x.SetString("1e81391777742999")
    fmt.Printf("x = %.6g\n", &x)
}

prints x = 1e+151 which is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions