*BSD News Article 17228


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!aardvark.ucs.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!raven.alaska.edu!decwrl!concert!gatech!
 howland.reston.ans.net!darwin.sura.net!news.dfn.de!mailgzrz.TU-Berlin.DE!
 news.netmbx.de!Germany.EU.net!mcsun!sun4nl!hacktic!not-for-mail
Newsgroups: comp.os.386bsd.questions
Subject: Re: perl pl36
Message-ID: <1vnmrvINN7oi@xs4all.hacktic.nl>
From: cor@hacktic.nl (Cor)
Date: 16 Jun 1993 19:56:01 +0200
References: <1vfi5hINNg80@xs4all.hacktic.nl> <1993Jun16.141721.10321@craycos.com>
Organization: Hack-Tic, networking for the masses
NNTP-Posting-Host: xs4all.hacktic.nl
Lines: 32

scott@craycos.com (Scott Bolte) 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

I figured it was doing rounding instead of truncating like its supposed to.
Does anyone know what can be causing this? My guess would be cc, but
dont quote me on that :) Am I the only one with this problem?
Perhaps some people with perl on their 386bsd boxes (patchlevel 36 is what
im using) could try it? Its really annoying, cause I cant be sure a script
written on another machine will work, cause it may rely on integers being
truncated. And yes..ive already had to change scripts cause of it.
Hmm..actually..i'll try and compile perl with gcc in a sec :)
cor

-- 
| cor@hacktic.nl | Hack-Tic System Management | +31-20-6001480-3 (VMB)  |
| -------------------------------------------------------------------------|
|   ######### Signature Virus Running. Contamination Complete #########    |
+--------------------------------------------------------------------------+