You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected Acc to give the accuracy of the last operation, as documented, in this case being Text or Append.
There currently seems to be no way to determine the accuracy of a printed string. If this cannot be supported, an alternative solutions would be: a) have a separate method to get the digits of a float, b) have a big.Decimal that allows to be converted to that would allow getting the information in a similar way as is possible with SetPrec and the like in big.Float.
What did you see instead?
It does not.
The text was updated successfully, but these errors were encountered:
I expected Acc to give the accuracy of the last operation, as documented, in this case being Text or Append.
But Text and Append do not change the receiver... they just generate strings. Why do you expect Acc to change? Acc describes the rounding error of the last operation that sets/modifies the big.Float value. When you call f.Text('f', 0), f is untouched, and so is its f.acc field.
Per https://golang.org/pkg/math/big/#Float.Acc, Acc returns the accuracy of a value produced by the most recent operation. Your computing the the accuracy of f which has not changed after creation. This is working as intended as @ALTree already pointed out.
A printed string is a string and you can do whatever you want with it. I don't know what "accuracy of a printed string" should be.
There's already a MathExp function that allows you to split out the mantissa and exponent of a *Float, and the same techniques we use for float64 values can be used to create an (big.Int)eger value from it can be used.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7 darwin/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go1.7"
GOTOOLDIR="/usr/local/go1.7/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
What did you do?
Calling Append and Text on big.Float and determine the accuracy of the result.
https://play.golang.org/p/gxa_HDy-Ul
What did you expect to see?
I expected Acc to give the accuracy of the last operation, as documented, in this case being Text or Append.
There currently seems to be no way to determine the accuracy of a printed string. If this cannot be supported, an alternative solutions would be: a) have a separate method to get the digits of a float, b) have a big.Decimal that allows to be converted to that would allow getting the information in a similar way as is possible with SetPrec and the like in big.Float.
What did you see instead?
It does not.
The text was updated successfully, but these errors were encountered: