This is the mail archive of the gcc-bugs@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]

[Bug c/16850] modulo - feature or bug?


------- Additional Comments From segher at kernel dot crashing dot org  2004-08-24 09:15 -------
Subject: Re:  modulo - feature or bug?

> For the scientific modulo the integer() function yields the lower
> bound integer of the float argument. In C it appears that integer(f)
> always equals integer(abs(f)). As a consequence, C modulo's integer
> function does not fulfil the equation
>
>   integer(f+n) = integer(f) + n
>   n := any integer
>
> for every f while n!=0. That's bad ground for algebra!

On the bright side, the equation

	int(a/b + n) = int(a/b) + n

works fine for all a, b, n where a/b is defined in the
algebraic sense (and note we're talking integers here).

"Computer division" has nothing to do with algebraic
division (well, not very much, anyway).  Better get
used to it :-)


Segher



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16850


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