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 fortran/33595] FAIL: gfortran.dg/nint_2.f90 -O0 execution test



------- Comment #13 from kargl at gcc dot gnu dot org  2008-12-28 22:14 -------
(In reply to comment #12)
> Subject: Re:  FAIL: gfortran.dg/nint_2.f90  -O0  execution test
> 
> > See libm on FreeBSD.
> > 
> > http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/src/s_roundf.c
> 
> So, the ceilf implementation was changed to a floorf implementation
> to correct rounding issues about three years ago...
> 
> I'll give it a try.  The default rounding mode on hpux is nearest.
> 

It also uses your idea or something very similar.  Notice the
changes in the if-statements.

        if (x >= 0.0) {
-               t = ceilf(x);
-               if (t - x > 0.5)
-                       t -= 1.0;
+               t = floorf(x);
+               if (t - x <= -0.5)
+                       t += 1.0;
                return (t);
        } else {
-               t = ceilf(-x);
-               if (t + x > 0.5)
-                       t -= 1.0;
+               t = floorf(-x);
+               if (t + x <= -0.5)
+                       t += 1.0;
                return (-t);
        }


-- 


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


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