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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,91965a012526b259 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!proxad.net!proxad.net!oleane.net!oleane!skymaster!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Float to String Date: Mon, 08 Nov 2004 19:29:22 +0100 Organization: Adalog Message-ID: <0udomc.ae8.ln@skymaster> References: NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: s5.feed.news.oleane.net 1099940861 12088 195.25.228.57 (8 Nov 2004 19:07:41 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 8 Nov 2004 19:07:41 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.2) Gecko/20040803 X-Accept-Language: fr-fr, en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:6052 Date: 2004-11-08T19:29:22+01:00 List-Id: Pascal Obry a =E9crit : > I was wondering if there is a way to save a float into a string and rea= d it > back without loosing precision ? >=20 > I tried something like: >=20 > F_Str : String (1 .. Float'Base'Digits); >=20 > Float_Text_IO.Put (F_Str, My_Float, Aft =3D> Float'Base'Digits); >=20 Of course, the catch is in "without loosing precision". This should be possible if you write it in base 2. Note that Get will=20 accept a binary floating point number, but you have to write you own Put.= --=20 --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr