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, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,19805810c471a6af X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-17 17:28:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Decimals after the point Date: Sun, 17 Nov 2002 17:35:39 -0800 Organization: AdaWorks Software Engineering Message-ID: <3DD843EB.54704091@adaworks.com> References: <4bhy9.52855$T_3.627411@wagner.videotron.net> Reply-To: richard@adaworks.com NNTP-Posting-Host: 41.b2.40.49 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 18 Nov 2002 01:28:14 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:31017 Date: 2002-11-18T01:28:14+00:00 List-Id: SteveD wrote: > "Genevieve B." wrote in message > > > I have an idea of putting my float into a string instead and then check > for > > the point...and then check for only 2 numbers after it... > > > I like your approach: > Straightforward. > Easy to understand. > Easy to verify. > Gets the job done. I am reminded of a project that required reading floating point numbers from a VAX on an another computer. The project involved data from a site that had just lost a contract and they had to send the data to us. The sign bit for the VAX is smack-dab in the middle of the 32 bit word. Our machine had the sign bit in the high-order bit. We first struggled with a alorithm to convert VAX floats to our machine's floats. Then we abandoned that. Instead, we bought time on a VAX, converted all the VAX float to textual representation, and then read that into our system. This can be done so easily with Text_IO. The amazing thing is that many Ada programmers still don't know this and I still see some of them trying to write their own algorithms to convert floating point values to strings and vice-versa. Richard Riehle