From owner-freebsd-arch@FreeBSD.ORG Sun May 6 12:56:32 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 0357E16A407; Sun, 6 May 2007 12:56:32 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out-01.forthnet.gr (mx-out.forthnet.gr [193.92.150.103]) by mx1.freebsd.org (Postfix) with ESMTP id 7075E13C4BD; Sun, 6 May 2007 12:56:31 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-02.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-01.forthnet.gr (8.13.8/8.13.8) with ESMTP id l46CuRZj006004; Sun, 6 May 2007 15:56:27 +0300 Received: from MX-IN-03.forthnet.gr (mx-in-03.forthnet.gr [193.92.150.26]) by mx-av-02.forthnet.gr (8.14.1/8.14.1) with ESMTP id l46CuRbv017497; Sun, 6 May 2007 15:56:27 +0300 Received: from [192.168.136.22] (ppp124-213.adsl.forthnet.gr [193.92.231.213]) by MX-IN-03.forthnet.gr (8.14.1/8.14.1) with ESMTP id l46CuJxp002483; Sun, 6 May 2007 15:56:19 +0300 Authentication-Results: MX-IN-03.forthnet.gr from=dds@aueb.gr; sender-id=neutral; spf=neutral Message-ID: <463DD070.6090204@aueb.gr> Date: Sun, 06 May 2007 15:56:16 +0300 From: Diomidis Spinellis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070222 SeaMonkey/1.1.1 MIME-Version: 1.0 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> <20070506123102.GA56344@owl.midgard.homeip.net> In-Reply-To: <20070506123102.GA56344@owl.midgard.homeip.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: 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:56:32 -0000 Erik Trulsson wrote: > 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 You're right - my mistake. (I also tested this before posting (concidentally with 3.1415), but I botched when I converted the program I used for writing data on the SPARC into the program that read data on the i386 :-) Diomidis Spinellis