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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8200c5d9633351c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!news2.google.com!proxad.net!usenet-fr.net!news.enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: How to byte swap an IEEE Float? Date: Wed, 29 Jun 2005 20:52:34 -0400 Organization: Cuivre, Argent, Or Message-ID: References: <1119966822.201891.303810@g49g2000cwa.googlegroups.com> <1120039226.101013.221510@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: melchior.cuivre.fr.eu.org 1120092779 37910 212.85.156.195 (30 Jun 2005 00:52:59 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Thu, 30 Jun 2005 00:52:59 +0000 (UTC) Cc: comp.lang.ada@ada-france.org To: =?iso-8859-1?q?Bj=F6rn?= Return-Path: In-Reply-To: <1120039226.101013.221510@g43g2000cwa.googlegroups.com> (ssh9614@hotmail.com's message of "29 Jun 2005 03:00:26 -0700") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:11744 Date: 2005-06-29T20:52:34-04:00 "Bj=F6rn" writes: >> See SAL.Network_Order.Gen_Scalar_64 at >> http://www.toadmail.com/~ada_wizard/ada/sal.html for a convenient way >> to do this. > > Thanks! I will check it out. > >> Hmm. Are you saying the original value is _not_ a NaN? If so, then >> your swap implementation is faulty; try mine. > > No the original value _is_ a NaN when read as a float on x86 (the > subject on this thread was perhaps a bit misleading) Ok. So you have some code that generates a NaN, sends it over a network or something, and then some Ada code wants to store it in a Float value, still as a NaN. Unchecked_Conversion should support that. I'm not quite clear what will happen when you try to use the value or even assign the value; you'll probably get Constraint_Error. You might try 'Valid. The Ada model of floating point numbers does _not_ include NaN's, nor infinities.=20 --=20 -- Stephe