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

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> But, what then seems still strange is, why then also "Float'Succ(Float(Pi))"
> should return the same as "Float(Pi)".  See printed result #5 from my
> example code.  I looked up the respective rules in the ARM (2022 with
> additions from 2025, section 4.6):
> 
> - Float(Pi) is a type conversion, more precisely a value conversion.
> - A type_conversion that is a value conversion denotes the value that is
>   the result of converting the value of the operand to the target subtype.

I agree that this is more subtle, but the static semantics of a type conversion
do not say that the result is a machine number; they only say that the result
belongs to (the range of) the target subtype.

So Float (Ada.Numerics.Pi) = Ada.Numerics.Pi is a static context, therefore
Float'Succ (Float (Ada.Numerics.Pi)) = Float'Succ (Ada.Numerics.Pi) =
Float'Machine (Ada.Numerics.Pi).

That's of course different in a dynamic context or if RM 4.9(38/2) applies.

Reply via email to