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!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Float to String Date: Wed, 10 Nov 2004 09:53:09 +0100 Message-ID: References: <526nxsbun7e2.1n5a4jpe7u7ww$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de QkCOrEKoG5QejCvIoInH5wL0ybc0GVjk/49zj0F05fSopoZ4g= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:6105 Date: 2004-11-10T09:53:09+01:00 List-Id: On 09 Nov 2004 19:17:42 +0100, Pascal Obry wrote: > "Dmitry A. Kazakov" writes: > >> There is no any portable way to do so. > > Well if we could read/write a float in base 2 it would work I think. T�Machine_Radix is not necessarily 2. So abstractedly, 2 is not any better than 10, 60 or whatsoever. Though in most cases it would do the trick. > So it seems there is a way, but it seems quite a bit of work... If you mean a machine-specific representation like X -> ##E then I think it shouldn't be very difficult. If there are integers of mantissa length, then one could directly convert T'Compose (T'Fraction (X), T'Machine_Mantissa) to that integer. If they are shorter, then one could use S'Compose and S'Truncate to extract mantissa digits. These operations should be exact. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de