[Bug math/17569] remquo returns the wrong quotient

charles at karney dot com sourceware-bugzilla@sourceware.org
Sun Nov 9 15:02:00 GMT 2014


https://sourceware.org/bugzilla/show_bug.cgi?id=17569

--- Comment #1 from charles at karney dot com <charles at karney dot com> ---
(Sorry about the premature submission of the bug report.  Perhaps "enter"
shouldn't do a submit...)

Compiling and running the following code

int main() {
  int n;
  double x = 3419, m = 360;
  double y = __builtin_remainder(x, m);
  double z = __builtin_remquo(x, m, &n);
  __builtin_printf("result %.0f %.0f %d\n", y, z, n);
}

with 

  gcc -O0 -o remquo-bug remquo-bug.c -lm && ./remquo-bug

gives (second number is wrong)

  result 179 539 8

On the other hand

  gcc -O1 -o remquo-bug remquo-bug.c -lm && ./remquo-bug

gives the correct result

  result 179 179 9

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list