From owner-freebsd-arch@FreeBSD.ORG Sun May 6 12:46:17 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0E28116A407 for ; Sun, 6 May 2007 12:46:17 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id 8D57613C45B for ; Sun, 6 May 2007 12:46:16 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-10-135.bredband.comhem.se ([83.253.10.135]:58961 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.66) (envelope-from ) id 1HkftJ-0006iR-3d for arch@freebsd.org; Sun, 06 May 2007 14:31:05 +0200 Received: (qmail 32433 invoked from network); 6 May 2007 14:31:02 +0200 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with SMTP; 6 May 2007 14:31:02 +0200 Received: (qmail 56452 invoked by uid 1001); 6 May 2007 14:31:02 +0200 Date: Sun, 6 May 2007 14:31:02 +0200 From: Erik Trulsson To: Diomidis Spinellis Message-ID: <20070506123102.GA56344@owl.midgard.homeip.net> Mail-Followup-To: Diomidis Spinellis , Peter Jeremy , arch@freebsd.org, Garance A Drosehn References: <19235.1178303887@critter.freebsd.dk> <463BB88F.4020804@aueb.gr> <463D9A7A.1080800@aueb.gr> <20070506101020.GL825@turion.vk2pj.dyndns.org> <463DBF7A.8070200@aueb.gr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <463DBF7A.8070200@aueb.gr> User-Agent: Mutt/1.5.14 (2007-02-12) X-ACL-Warn: Too high rate of unknown addresses received from you X-Scan-Result: No virus found in message 1HkftJ-0006iR-3d. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1HkftJ-0006iR-3d a00fd35e046cac4d28c517dafbc4c977 Cc: Garance A Drosehn , arch@freebsd.org Subject: Re: Accounting changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2007 12:46:17 -0000 On Sun, May 06, 2007 at 02:43:54PM +0300, Diomidis Spinellis wrote: > Peter Jeremy wrote: > >On 2007-May-06 12:06:02 +0300, Diomidis Spinellis wrote: > >>Garance A Drosehn wrote: > >>>Does this mean the new accounting record will be using the > >>>native-hardware format for floating point numbers? Does that mean > >>>the records produced will be different for different hardware? > >>My intention is to use the standard (IEEE 754-1985 / IEEE 854-1987 / IEC > >>60559) 32-bit float format. This is the C "float" type on all the > >>architectures we support. I could add a typedef clarifying this, but I > >>doubt we'll ever support an architecture (VAX?) where float is a > >>different format. > > > >IEEE-754 etc define how to interpret a 32-bit object as a floating > >point number. AFAIK, it does not define how that object is laid > >out in memory so that a float written on SPARC (big-endian) will > >be different to that written on an i386 (little-endian). > > IEEE-754 defines the order of bits in a number. The intention is to > allow lexicographical comparison of (valid) floating point numbers, > using the normal byte compare instructions. Not quite. They are defined in such a manner as to allow them to be lexicographically compared just as if they were integers. And just like integers the byte order can vary between different architectures. > If you write a file with a > float on a SPARC you can read it back correctly on an i386. No you can't. I just tested this to be certain. On a SPARC a 32-bit float with the value 3.14 is stored as the bytes (in hexadecimal notation): 40 48 f5 c3 On i386 the order is c3 f5 48 40 -- Erik Trulsson ertr1013@student.uu.se