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
What does 'go version' print?
go version go1.3beta2 +708e129e91a9 Wed May 21 16:01:54 2014 -0700 darwin/amd64
What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Go does not support the hex encoded floats produceable from the C verb %a in stdio.h
and float.hex/float.fromhex in Python.
2. Example numbers:
pi = 0x1.921fb54442d18p+1
-e = -0x1.5bf0a8b145769p+1
15.39453125 = f.65 = 0x1.eca0000000000p+3
2^-1070 = 0x0.0000000000010p-1022
http://play.golang.org/p/446DOTlpbw
What happened?
A bunch of errors.
What should have happened instead?
Please provide any additional information below.
I know that Go implements an equivalent syntax in the %b verb, but having %a would be
nice for cross compatibility with C, Python, and Java. The best part is that producing
the FormatFloat part of the code is trivial. The tricky part is, as always, getting the
parser to work right.
The text was updated successfully, but these errors were encountered:
Given the existence of %b, I don't see an argument for %a. It's nice to have a syntax
similar to C and Python, but the syntax is already different, and one more difference
doesn't matter.
Leaving this open for strconv issues.
Here's the beginning of a function that produces such output. It could use some
prettying up - removal of trailing zeros, the ability to handle flags for field width,
precision, etc.
by odysseus9672:
The text was updated successfully, but these errors were encountered: