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

--- Comment #5 from Dirk Herrmann <dirk.herrmann-privat at gmx dot de> ---
OK, now I understood why "Float'Succ(Pi)' is the same as 'Float(Pi)': Both
happen to end up with the machine number that is above Pi, which is itself not
a machine number.  Thanks a lot for your patience.


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.

=> The value of Float(Pi) is the result of converting Pi to the subtype Float.
=> Float(Pi) would denote a machine number adjacent to Pi.

- The nominal subtype of a type_conversion is its target subtype.

=> The nominal subtype of Float(Pi) is Float.

Consequently, Float'Succ(Float(Pi)) means, applying Float'Succ to an argument
of nominal subtype Float.

>From ARM again, Section 3.5, clause about S'Succ: 

- For a floating point type, the function returns the machine number (as
  defined in 3.5.7) immediately above the value of Arg

=> Float(Pi) already is a machine number.
=> Float'Succ(Float(Pi)) shall return the machine number immediately above the
value of Float(Pi).

=> Float(Pi) and Float'Succ(Float(Pi)) should not be the same values.

Reply via email to