Repository navigation
BUG: str(np.float) should print with the same number of digits as python str(float) - #9966
Conversation
abe916b to
3f6f653
Compare
|
Interesting: In python3, the See https://bugs.python.org/issue9337 So I guess the design decision here is, should we ouput the shorter |
Sounds right to me. Python 2 is starting to recede in the rear mirror, time to prepare folks for 3 :0 |
9d30142 to
38eb425
Compare
There was a problem hiding this comment.
This doesn't look safe to me. Shouldn't it be do {} while(0)?
There was a problem hiding this comment.
This should have :dragon4_positional after the list of types, to produce a more useful error.
There was a problem hiding this comment.
Can you add a comment explaining the purpose of cutoffNumber >= 0? the only comment i can see in this diff about cutoffNumber == -1 is a deletion!
5ea534e to
ac8de9e
Compare
|
Updated. Although, curiously I see no effect of adding |
7161d83 to
edc5dee
Compare
edc5dee to
386b8b4
Compare
386b8b4 to
719afcc
Compare
|
Is this ready? |
|
As far as I am concerned, yes. |
|
OK, in it goes. Thanks Allan. |
See pandas-dev/pandas#18123
This makes numpy floating-point scalars
strandrepr(ie,str(np.float64(1.2345))) print in the same way as python floats (done in the 2nd commit). That is:struses 8 digits, in fixed mode for1e-4 < x < 1e11and scientific mode otherwise.repruses as many digits as needed to specify the value uniquely, in fixed mode for1e-4 < x < 1e16and scientific mode otherwise.(Updated: Both
strandreprnow print all digits, like floats in python3.)The PR is so big because I needed to expose control of the digit cutoff mode in the Dragon4 algorithm, which I had left hidden before. That's all in the 1st commit. This allows you to control whether
precisionrefers to the number of digits past 0, or the number of significant digits. An example:This was required to fix the scalar
strbecause Python outputs floats withfractional=False, while in numpy arrays we usefractional=True.