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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: 32-bit float and 64-bit float Date: Mon, 14 Aug 2017 11:42:06 +0300 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: 9Cu+nHRZQEwBmEgqwIkRuA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.14.10 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:47721 Date: 2017-08-14T11:42:06+03:00 List-Id: Dmitry A. Kazakov wrote: > On 14/08/2017 00:29, Victor Porton wrote: >> What is the best way to define in Ada types which are expected to >> contain: >> >> 1. 64-bit floating point numbers (incl. ±Inf, ±0, NaN); >> >> 2. 32-bit floating point numbers (incl. ±Inf, ±0, NaN). > > There is no way since you specified neither the precision and range nor > the floating-point representation format IEEE 754, IBM, DEC etc. > > Ada's way is the former. The latter is not possible in general. > > If you have a requirement to support a specific representation, e.g. for > I/O you have to convert it forth and back to an Ada type most close to > it. In Simple Components there are packages to convert IEEE 754 floats: > > http://www.dmitry-kazakov.de/ada/components.htm#IEEE_754 I understand this. My question was how to do it in the "best" (not "perfect") way. I think Float and Long_Float will do the job on most compilers and machines. But maybe I should instead use "digits" in Ada? If yes, then how many digits? -- Victor Porton - http://portonvictor.org