https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124163

--- Comment #3 from Dirk Herrmann <dirk.herrmann-privat at gmx dot de> ---
(In reply to Eric Botcazou from comment #1)
> Ada.Numerics.Pi is a named number so every static operation is performed
> with infinite precision on it, include 'Succ and 'Adjacent.
> 
> Float'Succ returns the Float machine number immediately above it, which is
> 0x40490fdb in hexadecimal format.  This machine number is also what is
> returned when it is converted to Float, for example Float'Machine (Pi),
> because it's the nearest machine number.
> 
> So Float'Succ (Pi) = Float'Machine (Pi) = Float_Pi in your example.

Thanks, but I have not yet fully understood: Do you mean to say that performing
Float'Succ(Pi) with infinite precision (as it is a static expression) should
mean to add an infinitely small increment?

As I understand it, the following are also static expressions (because they are
using named numbers and constants initialized from static expressions:

   Const_Float_Pi : constant Float := Pi;
   Const_Succ_Pi : constant Float := Float'Succ(Const_Float_Pi);

Following that reasoning, here, also, Float'Succ(Const_Float_Pi) would have to
be performed with infinite precision.  In this example, however,
Float'Succ(Const_Float_Pi) != Float_Pi.

Reply via email to