This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/8733: Modulus operator incorrect


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]