comp.lang.ada
 help / color / mirror / Atom feed
From: pburnand0-news@yahoo.com
Subject: Re: Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types?
Date: Thu, 04 Mar 2004 06:32:38 +0100
Date: 2004-03-04T06:32:38+01:00	[thread overview]
Message-ID: <4046b474_1@127.0.0.1> (raw)
In-Reply-To: c1ptub$1kmst4$1@ID-76083.news.uni-berlin.de

Joachim Schrļæ½er wrote:

> A short question:
> 
> It's not so simple with floating point types, just swapping bytes, or is
> it? One has to swap all the bits or?
> Interfaces.IEEE_Float_32 has 1 bit sign, 23 bit mantissa and 8 bit
> exponent, Interfaces.IEEE_Float_64 has 1 bit sign, 52 bit mantissa and 11
> bit exponent when I remember correctly.
> 
> 
>     Achim

That's not easy because floats are really machine dependant.  That's not a 
simple endianess question.

The universal solution for this is to store your floating point number in 
ASCII in a string and then store the string.  That takes more place, but 
there is no portability problems since in every case, a float converted to 
a string always from left to right.  Then it's even possible to use the 
number using a different format or precision...

This way of doing is massively used in the database world...





  parent reply	other threads:[~2004-03-04  5:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-25  9:38 Little Endian -> Big Endian (Ada95 / GNAT) James Amor
2004-02-25 12:23 ` David C. Hoos
2004-02-26 15:43   ` James Amor
2004-02-26  5:59 ` Simon Wright
2004-02-27 20:38   ` Guillaume Foliard
2004-02-28 11:27   ` Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types? Joachim Schr�er
2004-02-29 16:32     ` Simon Wright
2004-03-04  5:32     ` pburnand0-news [this message]
2004-03-04 11:55       ` Little Endian -> Big Endian (Ada95 / GNAT),Whats " David C. Hoos
2004-03-04 13:12         ` Little Endian -> Big Endian (Ada95 / GNAT), Whats " Marius Amado Alves
2004-03-04 17:51           ` Warren W. Gay VE3WWG
2004-03-04 18:34             ` Hyman Rosen
2004-03-05 17:40               ` Warren W. Gay VE3WWG
2004-03-05 17:50                 ` Warren W. Gay VE3WWG
2004-03-05 13:48             ` pburnand0-news
2004-03-05 17:34               ` Warren W. Gay VE3WWG
2004-03-05 17:53                 ` Warren W. Gay VE3WWG
2004-03-05 13:29           ` pburnand0-news
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox