[issue24546] sequence index bug in random.choice
Stefan Krah
report at bugs.python.org
Sat Jul 4 14:17:41 CEST 2015
Stefan Krah added the comment:
People have posted the asm now:
https://mail.python.org/pipermail/python-list/2015-July/693509.html
The fmull result appears to be the same. The good gcc versions set
the control word to "truncate" and then use fistpl (single rounding
with the correct mode):
fmull -0x10(%ebp)
fnstcw -0x1a(%ebp)
movzwl -0x1a(%ebp),%eax
mov $0xc,%ah
mov %ax,-0x1c(%ebp)
fldcw -0x1c(%ebp)
fistpl -0x20(%ebp)
The bad versions dump the result of fmull to memory, using
"round-to-nearest" and *then* attempt to truncate with
cvttsd2si, which is too late.
fmull 0x18(%esp)
fstpl 0x8(%esp)
cvttsd2si 0x8(%esp),%eax
I suspect that there are passages in various standards that allow
both behaviors. ;)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24546>
_______________________________________
More information about the Python-bugs-list
mailing list