Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Oct 1998 11:28:21 -0700
From:      Mike Smith <mike@smith.net.au>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        jobaldwi@vt.edu, mike@smith.net.au, bde@FreeBSD.ORG, freebsd-chat@FreeBSD.ORG
Subject:   Re: Bug in rintf()?... 
Message-ID:  <199810211828.LAA01093@dingo.cdrom.com>
In-Reply-To: Your message of "Thu, 22 Oct 1998 04:11:58 %2B1000." <199810211811.EAA32442@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> >> I've been having a problem with rintf() not rounding properly, and I don't
> >> understand the code in /usr/src/libm/common_source/floor.c well enough to
> >> figure out where it is going wrong.  Here is the problem I'm having though:
> >
> >We actually use the Sun-supplied math library, so you should be looking 
> >at src/lib/msun/src/s_rintf.c
> >
> >>  rintf(3.5) returns 4.0
> >>  rintf(3910.5) returns 3910.0  (should return 3911.0)
> 
> This seems to be correct.  rintf() rounds to the nearest integer according
> to the prevailing rounding mode.  The default prevailing rounding mode
> is round-to-even.  rintf() even seems to get this right for all the
> other rounding modes (towards +Inf, towards -Inf and towards 0).

Where do you set the rounding mode?  The only reference I could find 
was fpsetround(), which offers nearest, -inf, +inf and truncate.  

math(3) lists 3 types for ieee754 (+inf, -inf and 0).

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810211828.LAA01093>