From: Victor Porton <porton@narod.ru>
Subject: Re: 32-bit float and 64-bit float
Date: Mon, 14 Aug 2017 11:42:06 +0300
Date: 2017-08-14T11:42:06+03:00 [thread overview]
Message-ID: <omrnp7$1ko3$1@gioia.aioe.org> (raw)
In-Reply-To: omrhgm$1bvn$1@gioia.aioe.org
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
next prev parent reply other threads:[~2017-08-14 8:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-13 22:29 32-bit float and 64-bit float Victor Porton
2017-08-14 6:55 ` Dmitry A. Kazakov
2017-08-14 8:42 ` Victor Porton [this message]
2017-08-14 9:01 ` Dmitry A. Kazakov
2017-08-15 18:11 ` Charles H. Sampson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox