comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: 32-bit float and 64-bit float
Date: Mon, 14 Aug 2017 08:55:19 +0200
Date: 2017-08-14T08:55:19+02:00	[thread overview]
Message-ID: <omrhgm$1bvn$1@gioia.aioe.org> (raw)
In-Reply-To: omqjtc$a7d$1@gioia.aioe.org

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

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2017-08-14  6:55 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 [this message]
2017-08-14  8:42   ` Victor Porton
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