From owner-freebsd-stable@FreeBSD.ORG Thu Nov 15 06:20:07 2007 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02EFF16A468 for ; Thu, 15 Nov 2007 06:20:07 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 90F7613C447 for ; Thu, 15 Nov 2007 06:20:06 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c220-239-20-82.belrs4.nsw.optusnet.com.au [220.239.20.82]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id lAF6K3xo030760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Nov 2007 17:20:04 +1100 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.1/8.14.1) with ESMTP id lAF6K2aO090159; Thu, 15 Nov 2007 17:20:02 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.1/8.14.1/Submit) id lAF6K2Mn090158; Thu, 15 Nov 2007 17:20:02 +1100 (EST) (envelope-from peter) Date: Thu, 15 Nov 2007 17:20:02 +1100 From: Peter Jeremy To: Pete French Message-ID: <20071115062002.GK89746@server.vk2pj.dyndns.org> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.16 (2007-06-09) Cc: stable@freebsd.org Subject: Re: Float problen running i386 inary on amd64 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2007 06:20:07 -0000 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 02, 2007 at 10:04:48PM +0000, Pete French wrote: > int > main(int argc, char *argv[]) > { > if(atof("3.2") =3D=3D atof("3.200")) > puts("They are equal"); > else > puts("They are NOT equal!"); > return 0; > } Since the program as defined above does not include any prototype for atof(), its return value is assumed to be int. The i386 code for the comparison is therefore: movl $.LC0, (%esp) call atof movl $.LC1, (%esp) movl %eax, %ebx call atof cmpl %eax, %ebx je .L7 Note that this is comparing the %eax returned by each atof(). Since atof() actually returns a double in %st(0) and %eax is a scratch register, the results are completely undefined. Unfortunately, I can't explain why an i386 would be different to an amd64 in i386 mode. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --liOOAslEiF7prFVr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHO+US/opHv/APuIcRAqtpAJ9ZxueKvs5Vs9UlwTIT1SBe1RzAsgCgiYTD q5pX6Hcxx6U1EVJn6VphecU= =PcA5 -----END PGP SIGNATURE----- --liOOAslEiF7prFVr--