From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,753ed1318517d414 X-Google-Attributes: gid111c93,public From: Tony Hammitt Subject: Re: floor() broken on Multia Date: 2000/03/03 Message-ID: <38BFFE80.3C86D283@kc.rr.com>#1/1 X-Deja-AN: 592760669 Content-Transfer-Encoding: 7bit References: <89mono$fhj$1@hyperion.triode.net.au> <38BF6352.238799B7@kc.rr.com> <89npn4$ddt$1@hyperion.triode.net.au> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rr.com X-Trace: typhoon2.kc.rr.com 952106623 24.94.177.74 (Fri, 03 Mar 2000 12:03:43 CST) MIME-Version: 1.0 Reply-To: thammitt@kc.rr.com NNTP-Posting-Date: Fri, 03 Mar 2000 12:03:43 CST Newsgroups: comp.os.linux.alpha Someone emailed me and said that the given kludge has problems with accuracy and overflow, which is kinda obvious once I think about it. You obviously have to limit the input range to +/-2^31 and it would be better to subtract something less than one for the negative case, so make it: y = (double)(int)((x<0)?x-0.999999999999:x); Sorry about the mixup, it was 1am after all... Tony telford@xenon.triode.net.au wrote: > > Tony Hammitt wrote: > > This isn't pretty, but it works: > > > y=floor(x); is equivalent to y=(double)(int)((x<0)?x-1:x); > > OK, thanks for that it seems to work without hanging since > it doesn't use the troublesome instruction. Worst case I can patch > the libc source and recompile everything (yuck). This is especially > annoying since I found that the X11 server contains the same bad > instructions and recompiling that is a big undertaking on a Multia. > > I'm trying a newer kernel... > > - Tel