[issue13889] str(float) and round(float) issues with FPU precision

2019-06-11 Thread Mark Dickinson
Change by Mark Dickinson : -- pull_requests: -13812 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue13889] str(float) and round(float) issues with FPU precision

2019-06-10 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +13812 pull_request: https://github.com/python/cpython/pull/13946 ___ Python tracker ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Slightly reworked patch. I plan to apply this shortly. - Use ~(_MCW_PC | _MCW_RC) rather than (_MCW_DN | ...), since this seems more future proof: there's a possibility that more flags could be added later. - Put the usual do { ... }

[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset dfc9a98a5fef by Mark Dickinson in branch '3.2': Issue #13889: On MSVC builds, set FPU control word at runtime for all string - float conversions. Patch by Samuel Iseli and Stefan Krah.

[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset bf3b77722c9f by Mark Dickinson in branch '2.7': Issue #13889: On MSVC builds, set FPU control word at runtime for all string - float conversions. Patch by Samuel Iseli and Stefan Krah.

[issue13889] str(float) and round(float) issues with FPU precision

2012-04-15 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-03-13 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: I've looked at the latest patch: It seems that new_387controlword is not set if old_387controlword already has the desired precision and rounding mode. Attached is a revised patch that uses the same logic as the Linux version. A couple

[issue13889] str(float) and round(float) issues with FPU precision

2012-03-13 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: BTW, the MSDN documentation at http://msdn.microsoft.com/en-us/library/e9b52ceh(v=vs.100).aspx is a bit confusing. Question 1: when doing __control87_2(new, mask, old, NULL), does the resulting value in old reflect the *new* FPU state or

[issue13889] str(float) and round(float) issues with FPU precision

2012-03-13 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Mark Dickinson rep...@bugs.python.org wrote: http://msdn.microsoft.com/en-us/library/e9b52ceh(v=vs.100).aspx Question 1: when doing __control87_2(new, mask, old, NULL), does the resulting value in old reflect the *new* FPU state or

[issue13889] str(float) and round(float) issues with FPU precision

2012-03-13 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: Stefan Krah rep...@bugs.python.org wrote: Stefan Krah stefan-use...@bytereef.org added the comment: Mark Dickinson rep...@bugs.python.org wrote: http://msdn.microsoft.com/en-us/library/e9b52ceh(v=vs.100).aspx Question 1: when

[issue13889] str(float) and round(float) issues with FPU precision

2012-03-13 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Thanks for the responses. As far as I'm concerned, this is good to go into all 3 maintained branches. Having said that, the 2.7 and 3.2 branches are currently at release candidate stage, so I think we should wait until after the releases.

[issue13889] str(float) and round(float) issues with FPU precision

2012-03-10 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Patch looks fine to me. A couple of minor points (which I'm happy to fix at commit time if you agree, and don't want to create a new patch): - it looks to me as though the #ifdef _WIN32 isn't necessary any more; it's enough that we're on

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-06 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: I can run the tests on win64, but it I think it would be nice to have a patch with exactly the same logic as the gcc-asm version (Mark already mentioned _MCW_PC | _MCW_RC). Another thing: _WIN32 might be defined on MinGW, but I'm not

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-06 Thread Samuel Iseli
Samuel Iseli samuel.is...@gmail.com added the comment: Completed the patch by adding the rounding-control bits to the mask (_MCW_RC) and making sure the macros only get defined for MS-VC compiler (#ifdef _MSC_VER). Ran the tests (python_d -m test.autotest) on win32. Seems OK. The tests that

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-05 Thread Samuel Iseli
Samuel Iseli samuel.is...@gmail.com added the comment: I can run the tests on 32bit. Would be nice if somebody else could do this on 64bit (my VS2008 machine is currently on 32bit-Windows). -- ___ Python tracker rep...@bugs.python.org

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-03 Thread Samuel Iseli
Samuel Iseli samuel.is...@gmail.com added the comment: I would definitely classify this as a bug in Python 2.7 as it breaks backwards-compatibility for embedding environments that default to 64bit FPU precision (e.g. Delphi). Additionally the bug is very hard to detect and leads to wrong

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-03 Thread Samuel Iseli
Samuel Iseli samuel.is...@gmail.com added the comment: There's an excess space after a line continuation backslash in my last patch, so it doesn't compile (pyport.h, line 567). Here's an additional patch that removes the space. Didn't find out how to combine the 2 revisions in one patch-file...

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-03 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: General shape of the patch looks good. I'd suggest using a mask of _MCW_PC | _MCW_RC instead of just _MCW_PC, so that the rounding mode is also set correctly. Probably rarely an issue in practice, but it's the same thing that we're doing

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-03 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- components: +Windows stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-02 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Hi Marc, the changes to the pythoncore.vcproj Visual-Studio file define the HAVE_VC_FUNC_FOR_X87 symbol. Okay, makes sense. I was distracted by the spurious reordering of in the diff for pythoncore.vcproj. Just to be clear, the intent

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-01 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- assignee: mark.dickinson - nosy: +jcea type: behavior - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-01 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Should this bug be marked as closed+committed? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-01 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- assignee: - mark.dickinson type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-02-01 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Should this bug be marked as closed+committed? No, the main issue is still under consideration. There were two issues here: (1) a clear bug, namely that the Py_SET_53BIT_PRECISION_* macros weren't being used for the dtoa calls when

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-29 Thread Samuel Iseli
Samuel Iseli samuel.is...@gmail.com added the comment: Hi Marc, the changes to the pythoncore.vcproj Visual-Studio file define the HAVE_VC_FUNC_FOR_X87 symbol. I use this symbol to enable the precision-setting macros in pyport.h. I made this similar to the existing code for gcc (linux). You

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Samuel Iseli
New submission from Samuel Iseli samuel.is...@gmail.com: We are using python as an embedded scripting environment in our ERP-product. Since upgrading to python2.7 we have serious issues with floats: 28710.0 '2870:.0' round(28710.0) 2870.0 We are embedding Python in a Delphi-application. The

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Eric V. Smith
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith, mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___ ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Samuel, can you regenerate your patch? The contents don't look right---I see changes to pyport.h, but none to floatobject.c (and some other spurious-looking changes to the project file). -- ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I'm a bit disturbed that we're not using the _Py_SET_53BIT_PRECISION_* macros in _Py_double_round; unless I'm missing something, that seems like a major omission. -- ___ Python tracker

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- type: - behavior versions: +Python 3.2, Python 3.3 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 5b884955 by Mark Dickinson in branch '3.2': Issue #13889: Add missing _Py_SET_53BIT_PRECISION_* calls around uses of dtoa.c functions in float round. http://hg.python.org/cpython/rev/5b884955 New changeset

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: but none to floatobject.c Bah, reading comprehension fail. Now that I look at your patch again, the floatobject.c changes are there (and pretty much match what I just committed). I assume that the changes to pythoncore.vcproj can be

[issue13889] str(float) and round(float) issues with FPU precision

2012-01-27 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- priority: high - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13889 ___ ___