Port-alpha archive

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

rint(3) ignore the prevailing rounding mode



Hi,

Looking into the t_fpsetround testcase failure on alpha [1], i noticed
that rint does not alter its behaviour according to the prevailing
rounding mode.

The alpha machines do not use dynamic rounding mode by default unlinke
other archs. Compilation with default options enfore normal ieee
rounding mode, which does not take the fpcr bits into account at run
time.

To be sure, i recompiled the whole math library with rounding mode
option set to dynamic (patch attached), and this fixed the failing
test.

This seems the way to go, but i wonder if compiling the whole library
with dynamic rounding mode can have some bad side effects ? Do we need
to restrict it for rint function family ?

Thanks.

[1] 
http://www.netbsd.org/~njoly/alpha-atf/47_atf.html#lib_libc_gen_t_fpsetround_fpsetround_basic

-- 
Nicolas Joly

Projects and Developments in Bioinformatics
Institut Pasteur, Paris.
Index: lib/libm/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libm/Makefile,v
retrieving revision 1.120
diff -u -p -r1.120 Makefile
--- lib/libm/Makefile   17 Sep 2011 10:51:52 -0000      1.120
+++ lib/libm/Makefile   26 Feb 2012 23:04:20 -0000
@@ -117,6 +117,10 @@ WARNS?=4
 .PATH: ${.CURDIR}/src
 .PATH: ${.CURDIR}/noieee_src
 
+.if (${MACHINE_ARCH} == "alpha")
+CFLAGS+= -mfp-rounding-mode=d
+.endif
+
 .if (${MACHINE_ARCH} != "vax")
 CPPFLAGS+= -D_MULTI_LIBM -D_POSIX_MODE
 # XXX noieee libm is gross


Home | Main Index | Thread Index | Old Index