From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,4ac6504560f5ef27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-03 20:46:03 PST Message-ID: <4046b474_1@127.0.0.1> From: pburnand0-news@yahoo.com Subject: Re: Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types? Newsgroups: comp.lang.ada Reply-To: pburnand0-news@yahoo.com Date: Thu, 04 Mar 2004 06:32:38 +0100 References: User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-13 Content-Transfer-Encoding: 8Bit X-Authenticated-User: $$laz_wrsc X-Comments: This message was posted through Newsfeed.com X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support, spam or any illegal or copyrighted postings. X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!! X-Report: Please report illegal or inappropriate use to You may also use our online abuse reporting from: http://www.newsfeed.com/abuseform.htm X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS) Organization: Newsfeed.com http://www.newsfeed.com 100,000+ UNCENSORED Newsgroups. Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out2.nntp.be!local!corp-news!not-for-mail Xref: archiver1.google.com comp.lang.ada:6047 Date: 2004-03-04T06:32:38+01:00 List-Id: 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...