This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/8733: Modulus operator incorrect
- From: jsulliva77 at yahoo dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 27 Nov 2002 17:02:16 -0000
- Subject: c/8733: Modulus operator incorrect
- Reply-to: jsulliva77 at yahoo dot com
>Number: 8733
>Category: c
>Synopsis: Modulus operator incorrect
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 27 09:06:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: James Sullivan
>Release: gcc 3.2
>Organization:
>Environment:
linux 2.4.18, running on intel.
>Description:
modulus operator incorrect:
int main( void ) {
printf("%d", (-5)%10 );
return 0;
}
<--- prints -5. The correct answer is 5. Modulus maps into Z+.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: