Issue 15057: Potential Bug in mpd_qdivint and mpd_qrem (original) (raw)

Issue15057

Created on 2012-06-13 17:42 by Ken.Cheung, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mpdecimal_clone.txt Ken.Cheung,2012-06-13 17:42
Messages (2)
msg162717 - (view) Author: Ken Cheung (Ken.Cheung) Date: 2012-06-13 17:42
I observed a code clone from the following files. function : mpd_qdivint @ (file: "Python-3.3.0a2/Modules/_decimal/libmpdec/mpdecimal.c", line: 3727)~3763 function : mpd_qrem @ (file: "Python-3.3.0a2/Modules/_decimal/libmpdec/mpdecimal.c", line: 6331)~6361 The function mpd_qdivint checks the condition "mpd_isinfinite(a) && mpd_isinfinite(b)" while mpd_qrem does not. I wonder if this is necessary in mpd_qrem. The source code is included in the attachment. Hope it helps.
msg162757 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012-06-14 07:50
I can see why it is seems strange that // and % behave differently. If anything, I'd change divint to raise for things like inf // 3. But the official test cases don't: dvix601 divideint -Inf -1000 -> Infinity remx701 remainder -Inf -1000 -> NaN Invalid_operation Since decimal follows the specification (and the test cases), we can't change that. So I'm closing the issue.
History
Date User Action Args
2022-04-11 14:57:31 admin set github: 59262
2012-06-14 07:50:18 skrah set status: open -> closedresolution: not a bugmessages: + stage: resolved
2012-06-13 18:15:17 ned.deily set nosy: + skrah
2012-06-13 17:42:55 Ken.Cheung set title: Potential Bugs in mpd_qdivint and mpd_qrem -> Potential Bug in mpd_qdivint and mpd_qrem
2012-06-13 17:42:39 Ken.Cheung create