IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 347 forks source link

Precision of array.array('d'|'f', "....") lost in CPython 2.7 #861

Open ironpythonbot opened 9 years ago

ironpythonbot commented 9 years ago

D:\rft\vsl\dlr\Languages\IronPython>27 -c "import array;print array.array('d', '\x12\x34\x45\x67\x12\x34\x45\x67')"
array('d', [2.95224853258877e+189])

D:\rft\vsl\dlr\Languages\IronPython>26 -c "import array;print array.array('d', '\x12\x34\x45\x67\x12\x34\x45\x67')"
array('d', [2.9522485325887698e+189])

D:\rft\vsl\dlr\Languages\IronPython>ipyd -c "import array;print array.array('d', '\x12\x34\x45\x67\x12\x34\x45\x67')"
array('d', [2.9522485325887698e+189])

Work Item Details

Original CodePlex Issue: Issue 28212 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 21, 2010 at 7:38 PM Reported by: dfugate Updated on: Feb 22, 2013 at 2:10 AM Updated by: jdhardy Test: array_test (test_cp9348)

slozier commented 8 years ago

This isn't a lack of precision on CPython's part, it's an issue with string representations of numbers in IronPython. In this case 2.95224853258877e+189 == 2.9522485325887698e+189 but the first representation is the shortest. See #1271.