* Re: glibc & ceil() [not found] <39F8090C.4268451C@voicenet.com> @ 2000-10-27 12:07 ` Uncle George 2000-10-27 12:45 ` Andrei A. Dergatchev 2000-10-27 17:40 ` Richard Henderson 0 siblings, 2 replies; 5+ messages in thread From: Uncle George @ 2000-10-27 12:07 UTC (permalink / raw) To: axp-list [-- Attachment #1: Type: text/plain, Size: 81 bytes --] Uncle George wrote: > is the correct result of ceil( -0.5) -0.0 or 0.0 ? > [-- Attachment #2: ceil.c --] [-- Type: application/octet-stream, Size: 206 bytes --] main() { double d, r; long fpcr; fpcr = (2L << 58 ); /* Normal Rounding */ asm volatile ( "mt_fpcr %0 ; excb" : : "f"(fpcr)); d = -0.5; r = ceil( d ); printf("d = %g, r = %g\n", d, r); } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: glibc & ceil() 2000-10-27 12:07 ` glibc & ceil() Uncle George @ 2000-10-27 12:45 ` Andrei A. Dergatchev 2000-10-27 13:13 ` Uncle George 2000-10-27 17:40 ` Richard Henderson 1 sibling, 1 reply; 5+ messages in thread From: Andrei A. Dergatchev @ 2000-10-27 12:45 UTC (permalink / raw) To: axp-list FWIW on Sparc Solaris 7 Sun C 5.0 with -xarch=v9a gives r = 0 > Uncle George wrote: > > > is the correct result of ceil( -0.5) -0.0 or 0.0 ? > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: glibc & ceil() 2000-10-27 12:45 ` Andrei A. Dergatchev @ 2000-10-27 13:13 ` Uncle George 2000-10-27 13:25 ` Andrei A. Dergatchev 0 siblings, 1 reply; 5+ messages in thread From: Uncle George @ 2000-10-27 13:13 UTC (permalink / raw) To: axp-list Some one pointed out that i need to include math.h ie #inclued <math.h> to get the right casting. But even with the correct casting, a ceil( -0.5 ) gives me a 0.0 /gat "Andrei A. Dergatchev" wrote: > FWIW on Sparc Solaris 7 Sun C 5.0 with -xarch=v9a gives r = 0 > > > Uncle George wrote: > > > > > is the correct result of ceil( -0.5) -0.0 or 0.0 ? > > > > > _______________________________________________ > Axp-list mailing list > Axp-list@redhat.com > https://listman.redhat.com/mailman/listinfo/axp-list ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: glibc & ceil() 2000-10-27 13:13 ` Uncle George @ 2000-10-27 13:25 ` Andrei A. Dergatchev 0 siblings, 0 replies; 5+ messages in thread From: Andrei A. Dergatchev @ 2000-10-27 13:25 UTC (permalink / raw) To: axp-list A-ga, with math.h Sun C gives "-0" Andrei > Some one pointed out that i need to include math.h > > ie > #inclued <math.h> > > to get the right casting. > But even with the correct casting, a ceil( -0.5 ) gives me a 0.0 > > /gat ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: glibc & ceil() 2000-10-27 12:07 ` glibc & ceil() Uncle George 2000-10-27 12:45 ` Andrei A. Dergatchev @ 2000-10-27 17:40 ` Richard Henderson 1 sibling, 0 replies; 5+ messages in thread From: Richard Henderson @ 2000-10-27 17:40 UTC (permalink / raw) To: axp-list On Fri, Oct 27, 2000 at 07:07:17AM -0500, Uncle George wrote: > > is the correct result of ceil( -0.5) -0.0 or 0.0 ? -0.0. Ceil and floor always preserve the sign of the input. There was a bug in the alpha glibc implementation for a while (I don't recall when it was introduced). It has been fixed for the upcoming 2.2 release. r~ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-10-27 17:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <39F8090C.4268451C@voicenet.com>
2000-10-27 12:07 ` glibc & ceil() Uncle George
2000-10-27 12:45 ` Andrei A. Dergatchev
2000-10-27 13:13 ` Uncle George
2000-10-27 13:25 ` Andrei A. Dergatchev
2000-10-27 17:40 ` Richard Henderson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox