This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients Kiriakos.Vlahos, brian.curtin, eric.smith, loewis, mark.dickinson, sjmachin, skrah
Date 2010-09-30.12:11:34
SpamBayes Score 2.4090905e-09
Marked as misclassified No
Message-id <20100930121056.GA6610@yoda.bytereef.org>
In-reply-to <1285845138.97.0.210600866172.issue9980@psf.upfronthosting.co.za>
Content
Mark Dickinson <report@bugs.python.org> wrote:
> Whoops;  that *was* string to float.  How about float to string?

These are the results for format_float_short. The first one is quite funny:

If the control word is left as is (64-bit prec on Linux), _Py_dg_dtoa
apparently requires more iterations (but still produces the correct
result in this case).

import timeit

s = "str(38210.0)"
t = timeit.Timer(stmt=s)

4.266580820083618
>>> t.timeit(number=10000000)
4.3112568855285645
>>> t.timeit(number=10000000)
4.313380002975464
>>>

3.7413151264190674
>>> t.timeit(number=10000000)
3.7296619415283203
>>> t.timeit(number=10000000)
3.737776041030884

3.756165027618408
>>> t.timeit(number=10000000)
3.775428056716919
>>> t.timeit(number=10000000)
3.775447130203247

In general, execution times for _Py_dg_dtoa vary quite a bit depending on
the number that is converted:

5.097490072250366

2.417008876800537

Judging from these numbers, I think the macros could be called by default without
any real effect on performance. How about setting the rounding mode as well (you
suggested that in #9009)?
History
Date User Action Args
2010-09-30 12:11:36skrahsetrecipients: + skrah, loewis, sjmachin, mark.dickinson, eric.smith, brian.curtin, Kiriakos.Vlahos
2010-09-30 12:11:35skrahlinkissue9980 messages
2010-09-30 12:11:34skrahcreate