[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] fix masking error in fesetround() on hppa



libc-alpha,

Thanks to HP's testdrive users, we found and fixed a small masking bug
in fesetround(). Should use ~FE_DOWNWARD since this is the rounding mask
set to all ones, and will clear the mask before or'ing the round value.

It was suggested that a test case could be made of this, where glibc
tries to set and get various combinations of FE_DOWNWARD, FE_UPWARD,
FE_TONEAREST, and FE_UPWARD. I could provide such a testcase if it was
deemed usefull. 

c.

---

2002-12-02  Carlos O'Donell  <carlos@baldric.uwo.ca>

	* sysdeps/hppa/fpu/fesetround.c: 
	(fesetround): Use ~FE_DOWNWARD so both bits of RM are cleared.
--- glibc-2.3.1/sysdeps/hppa/fpu/fesetround.c	2002-12-02 16:36:36.000000000 -0500
+++ glibc-2.3.1/sysdeps/hppa/fpu/fesetround.c	2002-12-02 16:36:59.000000000 -0500
@@ -31,7 +31,7 @@
 
   /* Get the current status word. */
   __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-  sw[0] &= ~FE_UPWARD;
+  sw[0] &= ~FE_DOWNWARD;
   sw[0] |= round;
   __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
 

Reply to: