Skip to content

math/big: Int64() conversion incorrect despite Exact accuracy #17305

@johnSchnake

Description

@johnSchnake

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7.1 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/johnschnake/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sw/m66hd5gs4jq4rgzr1s_hvv2c0000gn/T/go-build059909108=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/iVPRHj3eZ9

What did you expect to see?

"Correct and exact" as output; implying that since math/big accuracy of Float.Int64() reported Exact, that I would get the same value as the same input cast to an int64.

What did you see instead?

"Not equal, despite exact" as output; implying that even though the same values went in as inputs, and math/big reported the conversion could occur w/o rounding, the values were not equal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions