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.

classification
Title: Potential Bug in mpd_qdivint and mpd_qrem
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Ken.Cheung, skrah
Priority: normal Keywords:

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:31adminsetgithub: 59262
2012-06-14 07:50:18skrahsetstatus: open -> closed
resolution: not a bug
messages: + msg162757

stage: resolved
2012-06-13 18:15:17ned.deilysetnosy: + skrah
2012-06-13 17:42:55Ken.Cheungsettitle: Potential Bugs in mpd_qdivint and mpd_qrem -> Potential Bug in mpd_qdivint and mpd_qrem
2012-06-13 17:42:39Ken.Cheungcreate