*BSD News Article 17223


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!csn!copper!aspen.craycos.com!scott
From: scott@craycos.com (Scott Bolte)
Newsgroups: comp.os.386bsd.questions
Subject: Re: perl pl36
Message-ID: <1993Jun16.141721.10321@craycos.com>
Date: 16 Jun 93 14:17:21 GMT
References: <1vfi5hINNg80@xs4all.hacktic.nl>
Organization: Cray Computer Corporation
Lines: 23

In article <1vfi5hINNg80@xs4all.hacktic.nl> cor@hacktic.nl (Cor) writes:
	....
>perl -e 'printf "%d\n", 1.9' will print 2, and not 1 like its supposed to,
>
>Is this perhaps a bug in the math library of 386bsd? 

	It's not a bug, it is a feature!

	Actually, the difference is that (float) to (int) conversion is
	being done as a rounding operation instead of the more
	traditional, and correct, truncation. According to the ANSI C
	spec, section 3.2.1.3 of X3.159-1989, this behavior is
	incorrect. I have not tried to figure out if this is a X86
	feature or a cc/gcc bug.
			
			Scott
-- 
___________________________________________________________________________
Scott Bolte                 scott@craycos.com               +1 719 540 4186
Cray Computer Corporation, 1110 Bayfield Drive, Colorado Springs, CO  80906
	     As anyone here will tell you: I speak for myself.

	    *** On the Internet no one can hear you scream ***