This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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 math/17569] remquo returns the wrong quotient


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.


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