@@ -161,6 +161,11 @@ end function ieee_round_ne
161161
162162! Define specifics with 1 or 2 INTEGER, LOGICAL, or REAL arguments for
163163! generic G.
164+ !
165+ ! The result type of most function specifics is either a fixed type or
166+ ! the type of the first argument. The result type of a SPECIFICS_rRR
167+ ! function call is the highest precision argument type.
168+
164169#define SPECIFICS_I(G) \
165170 G(1 ) G(2 ) G(4 ) G(8 ) G(16 )
166171#define SPECIFICS_L(G) \
@@ -234,13 +239,26 @@ end function ieee_round_ne
234239 G(8 ,2 ) G(8 ,3 ) G(8 ,4 ) G(8 ,8 ) G(8 ,10 ) G(8 ,16 ) \
235240 G(10 ,2 ) G(10 ,3 ) G(10 ,4 ) G(10 ,8 ) G(10 ,10 ) G(10 ,16 ) \
236241 G(16 ,2 ) G(16 ,3 ) G(16 ,4 ) G(16 ,8 ) G(16 ,10 ) G(16 ,16 )
242+ #define SPECIFICS_rRR(G) \
243+ G(2 ,2 ,2 ) G(2 ,2 ,3 ) G(4 ,2 ,4 ) G(8 ,2 ,8 ) G(10 ,2 ,10 ) G(16 ,2 ,16 ) \
244+ G(2 ,3 ,2 ) G(3 ,3 ,3 ) G(4 ,3 ,4 ) G(8 ,3 ,8 ) G(10 ,3 ,10 ) G(16 ,3 ,16 ) \
245+ G(4 ,4 ,2 ) G(4 ,4 ,3 ) G(4 ,4 ,4 ) G(8 ,4 ,8 ) G(10 ,4 ,10 ) G(16 ,4 ,16 ) \
246+ G(8 ,8 ,2 ) G(8 ,8 ,3 ) G(8 ,8 ,4 ) G(8 ,8 ,8 ) G(10 ,8 ,10 ) G(16 ,8 ,16 ) \
247+ G(10 ,10 ,2 ) G(10 ,10 ,3 ) G(10 ,10 ,4 ) G(10 ,10 ,8 ) G(10 ,10 ,10 ) G(16 ,10 ,16 ) \
248+ G(16 ,16 ,2 ) G(16 ,16 ,3 ) G(16 ,16 ,4 ) G(16 ,16 ,8 ) G(16 ,16 ,10 ) G(16 ,16 ,16 )
237249#else
238250#define SPECIFICS_RR(G) \
239251 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 ,8 ) G(10 ,3 ,10 ) \
274+ G(4 ,4 ,2 ) G(4 ,4 ,3 ) G(4 ,4 ,4 ) G(8 ,4 ,8 ) G(10 ,4 ,10 ) \
275+ G(8 ,8 ,2 ) G(8 ,8 ,3 ) G(8 ,8 ,4 ) G(8 ,8 ,8 ) G(10 ,8 ,10 ) \
276+ G(10 ,10 ,2 ) G(10 ,10 ,3 ) G(10 ,10 ,4 ) G(10 ,10 ,8 ) G(10 ,10 ,10 )
253277#else
254278#define SPECIFICS_RR(G) \
255279 G(2 ,2 ) G(2 ,3 ) G(2 ,4 ) G(2 ,8 ) \
256280 G(3 ,2 ) G(3 ,3 ) G(3 ,4 ) G(3 ,8 ) \
257281 G(4 ,2 ) G(4 ,3 ) G(4 ,4 ) G(4 ,8 ) \
258282 G(8 ,2 ) G(8 ,3 ) G(8 ,4 ) G(8 ,8 )
283+ #define SPECIFICS_rRR(G) \
284+ G(2 ,2 ,2 ) G(2 ,2 ,3 ) G(4 ,2 ,4 ) G(8 ,2 ,8 ) \
285+ G(2 ,3 ,2 ) G(3 ,3 ,3 ) G(4 ,3 ,4 ) G(8 ,3 ,8 ) \
286+ G(4 ,4 ,2 ) G(4 ,4 ,3 ) G(4 ,4 ,4 ) G(8 ,4 ,8 ) \
287+ G(8 ,8 ,2 ) G(8 ,8 ,3 ) G(8 ,8 ,4 ) G(8 ,8 ,8 )
259288#endif
260289#endif
261290
@@ -467,16 +496,16 @@ end function ieee_quiet_ne_a##AKIND;
467496 public :: ieee_quiet_ne
468497#undef IEEE_QUIET_NE_R
469498
470- #define IEEE_REM_RR( XKIND, YKIND) \
471- elemental real (XKIND ) function ieee_rem_a##XKIND##_a##YKIND(x, y); \
499+ #define IEEE_REM_rRR(RKIND, XKIND, YKIND) \
500+ elemental real (RKIND ) function ieee_rem_a##XKIND##_a##YKIND(x, y); \
472501 real (XKIND), intent (in ) :: x; \
473502 real (YKIND), intent (in ) :: y; \
474503 end function ieee_rem_a##XKIND##_a##YKIND;
475504 interface ieee_rem
476- SPECIFICS_RR(IEEE_REM_RR )
505+ SPECIFICS_rRR(IEEE_REM_rRR )
477506 end interface ieee_rem
478507 public :: ieee_rem
479- #undef IEEE_REM_RR
508+ #undef IEEE_REM_rRR
480509
481510#define IEEE_RINT_R(XKIND) \
482511 elemental real (XKIND) function ieee_rint_a##XKIND(x, round); \
0 commit comments