*BSD News Article 14416


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!gatech!concert!sas!mozart.unx.sas.com!torpid.unx.sas.com!sastdr
From: sastdr@torpid.unx.sas.com (Thomas David Rivers)
Subject: Re: Is there a fix for floor(), ceil()?
Sender: news@unx.sas.com (Noter of Newsworthy Events)
Message-ID: <C5FJCs.12I@unx.sas.com>
Date: Tue, 13 Apr 1993 16:05:15 GMT
References: <1993Apr6.193628.3040@mprgate.mpr.ca>
Nntp-Posting-Host: torpid.unx.sas.com
Organization: SAS Institute Inc.
Lines: 49

In article <1993Apr6.193628.3040@mprgate.mpr.ca> rosenaue@mpr.ca (Dennis Rosenauer) writes:
>
>I was attempting to compile some code which I have been running on a Sun
>on 386BSD.  I ran into a problem with floor() and ceil() not returning
>the correct value.  For example:
>
>/* test the floor function */
>
>#include <math.h>
>
>main()
>
>	{
>	printf("should be 10 but is %f\n",floor(10.9));
>	}
>
>does not return the expected value of 10 on 386BSD but works fine on
>with the Sun C compiler.
>
>Can anyone point me to a bug fix for this or is it my turn to fix this?
>I have all the patches installed (patches on agate as of about 2 weeks ago
>anyway) and all libraries and utilities recompiled.  I suspect that
>either the library function in libm is broken or gcc's "cast" function
>is broken.  Anyone have any ideas?
>
>Thanks
>
>-- 
>Dennis Rosenauer VE7BPE                  rosenaue@mprgate.mpr.ca
>MPR Teltech Ltd.
>Radio & Satellite Network Development    "For every vision there is an
>Burnaby, B. C.                            equal and opposite revision"



I believe this is a problem with the math emulator;  if you get
a floating point coprocessor - (or use a 486DX) it goes away.

I noticed it, and other floating point problems,  before when 
using some awk scripts which were getting the incorrect result.

If you do get a math coprocessor; stay away from ULSI.  I had
some problems with it, which other people have reported as well.
I've had very good results with INTEL and Cyrix coprocessors.

	- Dave R. -

-- 
UPDATE ALL INFORMATION AND POD INTO COSMOS - Federal Express