> On 24 Mar 2025, at 10:41, Andreas Schwab <sch...@suse.de> wrote:
> 
> * intrinsic.cc: Use standard f128 suffix for _Float128 literals.
> * libgcobol.cc: Likewise.

Note, I have WIP to adapt libgcobol to use libquadmath where the target does
not have native _Float128 in libc.  That patch also adapts the suffixes on 
literals
and math functions. [PR119244] 
current edition : 
https://forge.sourceware.org/iains/gcc-TEST/commit/690fc85c31264d6ce423495d5d8635ae58b91752
I expect to post that this week (assuming that the FE _Float128 changes land in
that timescale)
thanks
Iain

> ---
> libgcobol/intrinsic.cc | 18 +++++++++---------
> libgcobol/libgcobol.cc | 36 ++++++++++++++++++------------------
> 2 files changed, 27 insertions(+), 27 deletions(-)
> 
> diff --git a/libgcobol/intrinsic.cc b/libgcobol/intrinsic.cc
> index e3d255a29d6..6dfd98704c2 100644
> --- a/libgcobol/intrinsic.cc
> +++ b/libgcobol/intrinsic.cc
> @@ -55,7 +55,7 @@
> 
> #define JD_OF_1601_01_02 2305812.5
> 
> -#define WEIRD_TRANSCENDENT_RETURN_VALUE (0.0Q)
> +#define WEIRD_TRANSCENDENT_RETURN_VALUE (0.0f128)
> #define NO_RDIGITS (0)
> 
> struct cobol_tm
> @@ -981,7 +981,7 @@ __gg__acos( cblc_field_t *dest,
>   _Float128 value;
>   value = __gg__float128_from_qualified_field(source, source_offset, 
> source_size);
> 
> -  if( value < -1.00Q || value > +1.00Q )
> +  if( value < -1.00f128 || value > +1.00f128 )
>     {
>     exception_raise(ec_argument_function_e);
>     value = WEIRD_TRANSCENDENT_RETURN_VALUE;
> @@ -1056,7 +1056,7 @@ __gg__asin( cblc_field_t *dest,
>                                               source_offset,
>                                               source_size);
> 
> -  if( value < -1.0Q || value > +1.00Q )
> +  if( value < -1.0f128 || value > +1.00f128 )
>     {
>     exception_raise(ec_argument_function_e);
>     value = WEIRD_TRANSCENDENT_RETURN_VALUE;
> @@ -1366,7 +1366,7 @@ void
> __gg__e(cblc_field_t *dest)
>   {
>   // FUNCTION E
> -  static _Float128 e = 2.7182818284590452353602874713526624977572Q;
> +  static _Float128 e = 2.7182818284590452353602874713526624977572f128;
>   __gg__float128_to_field(dest,
>                           e,
>                           truncation_e,
> @@ -1404,7 +1404,7 @@ __gg__exp10(cblc_field_t *dest,
>   _Float128 value = __gg__float128_from_qualified_field(source,
>                                                         source_offset,
>                                                         source_size);
> -  value = powf128(10.0Q, value);
> +  value = powf128(10.0f128, value);
>   __gg__float128_to_field(dest,
>                           value,
>                           truncation_e,
> @@ -3169,7 +3169,7 @@ __gg__pi(cblc_field_t *dest)
>   {
>   // FUNCTION PI
> 
> -  static _Float128 pi = 3.141592653589793238462643383279502884Q;
> +  static _Float128 pi = 3.141592653589793238462643383279502884f128;
>   __gg__float128_to_field(dest,
>                           pi,
>                           truncation_e,
> @@ -3198,12 +3198,12 @@ __gg__present_value(cblc_field_t *dest,
>         _Float128 arg1 = 
> __gg__float128_from_qualified_field(__gg__treeplet_1f[i],
>                                                              
> __gg__treeplet_1o[i],
>                                                              
> __gg__treeplet_1s[i]);
> -        if( arg1 <= -1.0Q )
> +        if( arg1 <= -1.0f128 )
>           {
>           exception_raise(ec_argument_function_e);
>           break;
>           }
> -        discount = 1.0Q / (1.0Q + arg1);
> +        discount = 1.0f128 / (1.0f128 + arg1);
>         }
>       else
>         {
> @@ -3562,7 +3562,7 @@ __gg__sqrt( cblc_field_t *dest,
>                                                         source_offset,
>                                                         source_size);
> 
> -  if( value <= 0.0Q )
> +  if( value <= 0.0f128 )
>     {
>     exception_raise(ec_argument_function_e);
>     }
> diff --git a/libgcobol/libgcobol.cc b/libgcobol/libgcobol.cc
> index 0890835822c..be179d4d9b9 100644
> --- a/libgcobol/libgcobol.cc
> +++ b/libgcobol/libgcobol.cc
> @@ -858,7 +858,7 @@ int128_to_int128_rounded( cbl_round_t rounded,
>   _Float128 fpart = _Float128(remainder) / _Float128(factor);
>   __int128 retval = value;
> 
> -  if(rounded == nearest_even_e && fpart != -0.5Q && fpart != 0.5Q )
> +  if(rounded == nearest_even_e && fpart != -0.5f128 && fpart != 0.5f128 )
>     {
>     // "bankers rounding" has been requested.
>     //
> @@ -879,14 +879,14 @@ int128_to_int128_rounded( cbl_round_t rounded,
>       // 0.5 through 0.9 becomes 1
>       if( value < 0 )
>         {
> -        if( fpart <= -0.5Q )
> +        if( fpart <= -0.5f128 )
>           {
>           retval -= 1;
>           }
>         }
>       else
>         {
> -        if( fpart >= 0.5Q )
> +        if( fpart >= 0.5f128 )
>           {
>           retval += 1;
>           }
> @@ -920,14 +920,14 @@ int128_to_int128_rounded( cbl_round_t rounded,
>       // 0.6 through 0.9 becomes 1
>       if( value < 0 )
>         {
> -        if( fpart < -0.5Q )
> +        if( fpart < -0.5f128 )
>           {
>           retval -= 1;
>           }
>         }
>       else
>         {
> -        if( fpart > 0.5Q )
> +        if( fpart > 0.5f128 )
>           {
>           retval += 1;
>           }
> @@ -1017,7 +1017,7 @@ f128_to_i128_rounded( cbl_round_t rounded,
>   _Float128 fpart = modff128(value, &ipart);
>   __int128 retval = (__int128)ipart;
> 
> -  if(rounded == nearest_even_e &&  fpart != -0.5Q && fpart != 0.5Q )
> +  if(rounded == nearest_even_e &&  fpart != -0.5f128 && fpart != 0.5f128 )
>     {
>     // "bankers rounding" has been requested.
>     //
> @@ -1038,14 +1038,14 @@ f128_to_i128_rounded( cbl_round_t rounded,
>       // 0.5 through 0.9 becomes 1
>       if( value < 0 )
>         {
> -        if( fpart <= -0.5Q )
> +        if( fpart <= -0.5f128 )
>           {
>           retval -= 1;
>           }
>         }
>       else
>         {
> -        if( fpart >= 0.5Q )
> +        if( fpart >= 0.5f128 )
>           {
>           retval += 1;
>           }
> @@ -1079,14 +1079,14 @@ f128_to_i128_rounded( cbl_round_t rounded,
>       // 0.6 through 0.9 becomes 1
>       if( value < 0 )
>         {
> -        if( fpart < -0.5Q )
> +        if( fpart < -0.5f128 )
>           {
>           retval -= 1;
>           }
>         }
>       else
>         {
> -        if( fpart > 0.5Q )
> +        if( fpart > 0.5f128 )
>           {
>           retval += 1;
>           }
> @@ -9229,12 +9229,12 @@ float128_to_int128( int          *rdigits,
>     // We now multiply our value by 10**rdigits, in order to make the
>     // floating-point value have the same magnitude as our target __int128
> 
> -    value *= powf128(10.0Q, (_Float128)(*rdigits));
> +    value *= powf128(10.0f128, (_Float128)(*rdigits));
> 
>     // We are ready to cast value to an __int128.  But this value could be
>     // too large to fit, which is an error condition we want to flag:
> 
> -    if( fabsf128(value) >= 1.0E38Q )
> +    if( fabsf128(value) >= 1.0E38f128 )
>       {
>       *compute_error = compute_error_overflow;
>       }
> @@ -9263,7 +9263,7 @@ float128_to_location( cblc_field_t   *tgt,
>         {
>         case 4:
>           if(    fabsf128(value) == (_Float128)INFINITY
> -              || fabsf128(value) > 3.4028235E38Q )
> +              || fabsf128(value) > 3.4028235E38f128 )
>             {
>             if( compute_error )
>               {
> @@ -9286,7 +9286,7 @@ float128_to_location( cblc_field_t   *tgt,
> 
>         case 8:
>           if(    fabsf128(value) == (_Float128)INFINITY
> -              || fabsf128(value) > 1.7976931348623157E308Q )
> +              || fabsf128(value) > 1.7976931348623157E308f128 )
>             {
>             if( compute_error )
>               {
> @@ -11529,7 +11529,7 @@ __gg__float32_from_int128(cblc_field_t *destination,
>                                             source->capacity);
>   value /= __gg__power_of_ten(rdigits);
> 
> -  if( fabsf128(value) > 3.4028235E38Q )
> +  if( fabsf128(value) > 3.4028235E38f128 )
>     {
>     if(size_error)
>       {
> @@ -11633,7 +11633,7 @@ __gg__float32_from_128( cblc_field_t *dest,
>   //_Float128 value = *(_Float128*)(source->data+source_offset);
>   _Float128 value;
>   memcpy(&value, source->data+source_offset, 16);
> -  if( fabsf128(value) > 3.4028235E38Q )
> +  if( fabsf128(value) > 3.4028235E38f128 )
>     {
>     retval = 1;
>     }
> @@ -11653,7 +11653,7 @@ __gg__float32_from_64(  cblc_field_t *dest,
>   {
>   int retval = 0;
>   _Float64 value = *(_Float64*)(source->data+source_offset);
> -  if( fabsf128(value) > 3.4028235E38Q )
> +  if( fabsf128(value) > 3.4028235E38f128 )
>     {
>     retval = 1;
>     }
> @@ -11675,7 +11675,7 @@ __gg__float64_from_128( cblc_field_t *dest,
>   // _Float128 value = *(_Float128*)(source->data+source_offset);
>   _Float128 value;
>   memcpy(&value, source->data+source_offset, 16);
> -  if( fabsf128(value) > 1.7976931348623157E308 )
> +  if( fabsf128(value) > 1.7976931348623157E308f128 )
>     {
>     retval = 1;
>     }
> -- 
> 2.49.0
> 
> 
> -- 
> Andreas Schwab, SUSE Labs, sch...@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Reply via email to