llvm-project
616 строк · 20.5 Кб
1!===-- module/ieee_arithmetic.f90 ------------------------------------------===!
2!
3! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4! See https://llvm.org/LICENSE.txt for license information.
5! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6!
7!===------------------------------------------------------------------------===!
8
9! Fortran 2018 Clause 17
10
11include '../include/flang/Runtime/magic-numbers.h'
12
13module ieee_arithmetic
14! F18 Clause 17.1p1:
15! The module IEEE_ARITHMETIC behaves as if it contained a USE statement for
16! IEEE_EXCEPTIONS; everything that is public in IEEE_EXCEPTIONS is public in
17! IEEE_ARITHMETIC.
18use __fortran_ieee_exceptions
19
20use __fortran_builtins, only: &
21ieee_away => __builtin_ieee_away, &
22ieee_down => __builtin_ieee_down, &
23ieee_fma => __builtin_fma, &
24ieee_is_nan => __builtin_ieee_is_nan, &
25ieee_is_negative => __builtin_ieee_is_negative, &
26ieee_is_normal => __builtin_ieee_is_normal, &
27ieee_nearest => __builtin_ieee_nearest, &
28ieee_next_after => __builtin_ieee_next_after, &
29ieee_next_down => __builtin_ieee_next_down, &
30ieee_next_up => __builtin_ieee_next_up, &
31ieee_other => __builtin_ieee_other, &
32ieee_round_type => __builtin_ieee_round_type, &
33ieee_scalb => scale, &
34ieee_selected_real_kind => __builtin_ieee_selected_real_kind, &
35ieee_support_datatype => __builtin_ieee_support_datatype, &
36ieee_support_denormal => __builtin_ieee_support_denormal, &
37ieee_support_divide => __builtin_ieee_support_divide, &
38ieee_support_inf => __builtin_ieee_support_inf, &
39ieee_support_io => __builtin_ieee_support_io, &
40ieee_support_nan => __builtin_ieee_support_nan, &
41ieee_support_rounding => __builtin_ieee_support_rounding, &
42ieee_support_sqrt => __builtin_ieee_support_sqrt, &
43ieee_support_standard => __builtin_ieee_support_standard, &
44ieee_support_subnormal => __builtin_ieee_support_subnormal, &
45ieee_support_underflow_control => __builtin_ieee_support_underflow_control, &
46ieee_to_zero => __builtin_ieee_to_zero, &
47ieee_up => __builtin_ieee_up
48
49
50implicit none
51
52! Set PRIVATE by default to explicitly only export what is meant
53! to be exported by this MODULE.
54private
55
56! Explicitly export the symbols from __fortran_builtins
57public :: ieee_away
58public :: ieee_down
59public :: ieee_fma
60public :: ieee_is_nan
61public :: ieee_is_negative
62public :: ieee_is_normal
63public :: ieee_nearest
64public :: ieee_other
65public :: ieee_next_after
66public :: ieee_next_down
67public :: ieee_next_up
68public :: ieee_round_type
69public :: ieee_scalb
70public :: ieee_selected_real_kind
71public :: ieee_support_datatype
72public :: ieee_support_denormal
73public :: ieee_support_divide
74public :: ieee_support_inf
75public :: ieee_support_io
76public :: ieee_support_nan
77public :: ieee_support_rounding
78public :: ieee_support_sqrt
79public :: ieee_support_standard
80public :: ieee_support_subnormal
81public :: ieee_support_underflow_control
82public :: ieee_to_zero
83public :: ieee_up
84
85! Explicitly export the symbols from __fortran_ieee_exceptions
86public :: ieee_flag_type
87public :: ieee_invalid
88public :: ieee_overflow
89public :: ieee_divide_by_zero
90public :: ieee_underflow
91public :: ieee_inexact
92public :: ieee_denorm
93public :: ieee_usual
94public :: ieee_all
95public :: ieee_modes_type
96public :: ieee_status_type
97public :: ieee_get_flag
98public :: ieee_get_halting_mode
99public :: ieee_get_modes
100public :: ieee_get_status
101public :: ieee_set_flag
102public :: ieee_set_halting_mode
103public :: ieee_set_modes
104public :: ieee_set_status
105public :: ieee_support_flag
106public :: ieee_support_halting
107
108type, public :: ieee_class_type
109private
110integer(kind=1) :: which = 0
111end type ieee_class_type
112
113type(ieee_class_type), parameter, public :: &
114ieee_signaling_nan = ieee_class_type(_FORTRAN_RUNTIME_IEEE_SIGNALING_NAN), &
115ieee_quiet_nan = ieee_class_type(_FORTRAN_RUNTIME_IEEE_QUIET_NAN), &
116ieee_negative_inf = ieee_class_type(_FORTRAN_RUNTIME_IEEE_NEGATIVE_INF), &
117ieee_negative_normal = &
118ieee_class_type(_FORTRAN_RUNTIME_IEEE_NEGATIVE_NORMAL), &
119ieee_negative_subnormal = &
120ieee_class_type(_FORTRAN_RUNTIME_IEEE_NEGATIVE_SUBNORMAL), &
121ieee_negative_zero = ieee_class_type(_FORTRAN_RUNTIME_IEEE_NEGATIVE_ZERO), &
122ieee_positive_zero = ieee_class_type(_FORTRAN_RUNTIME_IEEE_POSITIVE_ZERO), &
123ieee_positive_subnormal = &
124ieee_class_type(_FORTRAN_RUNTIME_IEEE_POSITIVE_SUBNORMAL), &
125ieee_positive_normal = &
126ieee_class_type(_FORTRAN_RUNTIME_IEEE_POSITIVE_NORMAL), &
127ieee_positive_inf = ieee_class_type(_FORTRAN_RUNTIME_IEEE_POSITIVE_INF), &
128ieee_other_value = ieee_class_type(_FORTRAN_RUNTIME_IEEE_OTHER_VALUE)
129
130type(ieee_class_type), parameter, public :: &
131ieee_negative_denormal = ieee_negative_subnormal, &
132ieee_positive_denormal = ieee_positive_subnormal
133
134interface operator(==)
135elemental logical function ieee_class_eq(x, y)
136import ieee_class_type
137type(ieee_class_type), intent(in) :: x, y
138end function ieee_class_eq
139elemental logical function ieee_round_eq(x, y)
140import ieee_round_type
141type(ieee_round_type), intent(in) :: x, y
142end function ieee_round_eq
143end interface operator(==)
144public :: operator(==)
145
146interface operator(/=)
147elemental logical function ieee_class_ne(x, y)
148import ieee_class_type
149type(ieee_class_type), intent(in) :: x, y
150end function ieee_class_ne
151elemental logical function ieee_round_ne(x, y)
152import ieee_round_type
153type(ieee_round_type), intent(in) :: x, y
154end function ieee_round_ne
155end interface operator(/=)
156public :: operator(/=)
157
158! Define specifics with 1 or 2 INTEGER, LOGICAL, or REAL arguments for
159! generic G.
160#define SPECIFICS_I(G) \
161G(1) G(2) G(4) G(8) G(16)
162#define SPECIFICS_L(G) \
163G(1) G(2) G(4) G(8)
164#if __x86_64__
165#define SPECIFICS_R(G) \
166G(2) G(3) G(4) G(8) G(10) G(16)
167#else
168#define SPECIFICS_R(G) \
169G(2) G(3) G(4) G(8) G(16)
170#endif
171#define SPECIFICS_II(G) \
172G(1,1) G(1,2) G(1,4) G(1,8) G(1,16) \
173G(2,1) G(2,2) G(2,4) G(2,8) G(2,16) \
174G(4,1) G(4,2) G(4,4) G(4,8) G(4,16) \
175G(8,1) G(8,2) G(8,4) G(8,8) G(8,16) \
176G(16,1) G(16,2) G(16,4) G(16,8) G(16,16)
177#if __x86_64__
178#define SPECIFICS_RI(G) \
179G(2,1) G(2,2) G(2,4) G(2,8) G(2,16) \
180G(3,1) G(3,2) G(3,4) G(3,8) G(3,16) \
181G(4,1) G(4,2) G(4,4) G(4,8) G(4,16) \
182G(8,1) G(8,2) G(8,4) G(8,8) G(8,16) \
183G(10,1) G(10,2) G(10,4) G(10,8) G(10,16) \
184G(16,1) G(16,2) G(16,4) G(16,8) G(16,16)
185#else
186#define SPECIFICS_RI(G) \
187G(2,1) G(2,2) G(2,4) G(2,8) G(2,16) \
188G(3,1) G(3,2) G(3,4) G(3,8) G(3,16) \
189G(4,1) G(4,2) G(4,4) G(4,8) G(4,16) \
190G(8,1) G(8,2) G(8,4) G(8,8) G(8,16) \
191G(16,1) G(16,2) G(16,4) G(16,8) G(16,16)
192#endif
193
194#if __x86_64__
195#define SPECIFICS_RR(G) \
196G(2,2) G(2,3) G(2,4) G(2,8) G(2,10) G(2,16) \
197G(3,2) G(3,3) G(3,4) G(3,8) G(3,10) G(3,16) \
198G(4,2) G(4,3) G(4,4) G(4,8) G(4,10) G(4,16) \
199G(8,2) G(8,3) G(8,4) G(8,8) G(8,10) G(8,16) \
200G(10,2) G(10,3) G(10,4) G(10,8) G(10,10) G(10,16) \
201G(16,2) G(16,3) G(16,4) G(16,8) G(16,10) G(16,16)
202#else
203#define SPECIFICS_RR(G) \
204G(2,2) G(2,3) G(2,4) G(2,8) G(2,16) \
205G(3,2) G(3,3) G(3,4) G(3,8) G(3,16) \
206G(4,2) G(4,3) G(4,4) G(4,8) G(4,16) \
207G(8,2) G(8,3) G(8,4) G(8,8) G(8,16) \
208G(16,2) G(16,3) G(16,4) G(16,8) G(16,16)
209#endif
210
211#define IEEE_CLASS_R(XKIND) \
212elemental type(ieee_class_type) function ieee_class_a##XKIND(x); \
213import ieee_class_type; \
214real(XKIND), intent(in) :: x; \
215end function ieee_class_a##XKIND;
216interface ieee_class
217SPECIFICS_R(IEEE_CLASS_R)
218end interface ieee_class
219public :: ieee_class
220#undef IEEE_CLASS_R
221
222#define IEEE_COPY_SIGN_RR(XKIND, YKIND) \
223elemental real(XKIND) function ieee_copy_sign_a##XKIND##_a##YKIND(x, y); \
224real(XKIND), intent(in) :: x; \
225real(YKIND), intent(in) :: y; \
226end function ieee_copy_sign_a##XKIND##_a##YKIND;
227interface ieee_copy_sign
228SPECIFICS_RR(IEEE_COPY_SIGN_RR)
229end interface ieee_copy_sign
230public :: ieee_copy_sign
231#undef IEEE_COPY_SIGN_RR
232
233#define IEEE_GET_ROUNDING_MODE_I(RKIND) \
234subroutine ieee_get_rounding_mode_i##RKIND(round_value, radix); \
235import ieee_round_type; \
236type(ieee_round_type), intent(out) :: round_value; \
237integer(RKIND), intent(in) :: radix; \
238end subroutine ieee_get_rounding_mode_i##RKIND;
239interface ieee_get_rounding_mode
240subroutine ieee_get_rounding_mode_0(round_value)
241import ieee_round_type
242type(ieee_round_type), intent(out) :: round_value
243end subroutine ieee_get_rounding_mode_0
244SPECIFICS_I(IEEE_GET_ROUNDING_MODE_I)
245end interface ieee_get_rounding_mode
246public :: ieee_get_rounding_mode
247#undef IEEE_GET_ROUNDING_MODE_I
248
249#define IEEE_GET_UNDERFLOW_MODE_L(GKIND) \
250subroutine ieee_get_underflow_mode_l##GKIND(gradual); \
251logical(GKIND), intent(out) :: gradual; \
252end subroutine ieee_get_underflow_mode_l##GKIND;
253interface ieee_get_underflow_mode
254SPECIFICS_L(IEEE_GET_UNDERFLOW_MODE_L)
255end interface ieee_get_underflow_mode
256public :: ieee_get_underflow_mode
257#undef IEEE_GET_UNDERFLOW_MODE_L
258
259! When kind argument is present, kind(result) is value(kind), not kind(kind).
260! That is not known here, so return integer(16).
261#define IEEE_INT_R(AKIND) \
262elemental integer function ieee_int_a##AKIND(a, round); \
263import ieee_round_type; \
264real(AKIND), intent(in) :: a; \
265type(ieee_round_type), intent(in) :: round; \
266end function ieee_int_a##AKIND;
267#define IEEE_INT_RI(AKIND, KKIND) \
268elemental integer(16) function ieee_int_a##AKIND##_i##KKIND(a, round, kind); \
269import ieee_round_type; \
270real(AKIND), intent(in) :: a; \
271type(ieee_round_type), intent(in) :: round; \
272integer(KKIND), intent(in) :: kind; \
273end function ieee_int_a##AKIND##_i##KKIND;
274interface ieee_int
275SPECIFICS_R(IEEE_INT_R)
276SPECIFICS_RI(IEEE_INT_RI)
277end interface ieee_int
278public :: ieee_int
279#undef IEEE_INT_R
280#undef IEEE_INT_RI
281
282#define IEEE_IS_FINITE_R(XKIND) \
283elemental logical function ieee_is_finite_a##XKIND(x); \
284real(XKIND), intent(in) :: x; \
285end function ieee_is_finite_a##XKIND;
286interface ieee_is_finite
287SPECIFICS_R(IEEE_IS_FINITE_R)
288end interface ieee_is_finite
289public :: ieee_is_finite
290#undef IEEE_IS_FINITE_R
291
292#define IEEE_LOGB_R(XKIND) \
293elemental real(XKIND) function ieee_logb_a##XKIND(x); \
294real(XKIND), intent(in) :: x; \
295end function ieee_logb_a##XKIND;
296interface ieee_logb
297SPECIFICS_R(IEEE_LOGB_R)
298end interface ieee_logb
299public :: ieee_logb
300#undef IEEE_LOGB_R
301
302#define IEEE_MAX_R(XKIND) \
303elemental real(XKIND) function ieee_max_a##XKIND(x, y); \
304real(XKIND), intent(in) :: x, y; \
305end function ieee_max_a##XKIND;
306interface ieee_max
307SPECIFICS_R(IEEE_MAX_R)
308end interface ieee_max
309public :: ieee_max
310#undef IEEE_MAX_R
311
312#define IEEE_MAX_MAG_R(XKIND) \
313elemental real(XKIND) function ieee_max_mag_a##XKIND(x, y); \
314real(XKIND), intent(in) :: x, y; \
315end function ieee_max_mag_a##XKIND;
316interface ieee_max_mag
317SPECIFICS_R(IEEE_MAX_MAG_R)
318end interface ieee_max_mag
319public :: ieee_max_mag
320#undef IEEE_MAX_MAG_R
321
322#define IEEE_MAX_NUM_R(XKIND) \
323elemental real(XKIND) function ieee_max_num_a##XKIND(x, y); \
324real(XKIND), intent(in) :: x, y; \
325end function ieee_max_num_a##XKIND;
326interface ieee_max_num
327SPECIFICS_R(IEEE_MAX_NUM_R)
328end interface ieee_max_num
329public :: ieee_max_num
330#undef IEEE_MAX_NUM_R
331
332#define IEEE_MAX_NUM_MAG_R(XKIND) \
333elemental real(XKIND) function ieee_max_num_mag_a##XKIND(x, y); \
334real(XKIND), intent(in) :: x, y; \
335end function ieee_max_num_mag_a##XKIND;
336interface ieee_max_num_mag
337SPECIFICS_R(IEEE_MAX_NUM_MAG_R)
338end interface ieee_max_num_mag
339public :: ieee_max_num_mag
340#undef IEEE_MAX_NUM_MAG_R
341
342#define IEEE_MIN_R(XKIND) \
343elemental real(XKIND) function ieee_min_a##XKIND(x, y); \
344real(XKIND), intent(in) :: x, y; \
345end function ieee_min_a##XKIND;
346interface ieee_min
347SPECIFICS_R(IEEE_MIN_R)
348end interface ieee_min
349public :: ieee_min
350#undef IEEE_MIN_R
351
352#define IEEE_MIN_MAG_R(XKIND) \
353elemental real(XKIND) function ieee_min_mag_a##XKIND(x, y); \
354real(XKIND), intent(in) :: x, y; \
355end function ieee_min_mag_a##XKIND;
356interface ieee_min_mag
357SPECIFICS_R(IEEE_MIN_MAG_R)
358end interface ieee_min_mag
359public :: ieee_min_mag
360#undef IEEE_MIN_MAG_R
361
362#define IEEE_MIN_NUM_R(XKIND) \
363elemental real(XKIND) function ieee_min_num_a##XKIND(x, y); \
364real(XKIND), intent(in) :: x, y; \
365end function ieee_min_num_a##XKIND;
366interface ieee_min_num
367SPECIFICS_R(IEEE_MIN_NUM_R)
368end interface ieee_min_num
369public :: ieee_min_num
370#undef IEEE_MIN_NUM_R
371
372#define IEEE_MIN_NUM_MAG_R(XKIND) \
373elemental real(XKIND) function ieee_min_num_mag_a##XKIND(x, y); \
374real(XKIND), intent(in) :: x, y; \
375end function ieee_min_num_mag_a##XKIND;
376interface ieee_min_num_mag
377SPECIFICS_R(IEEE_MIN_NUM_MAG_R)
378end interface ieee_min_num_mag
379public ::ieee_min_num_mag
380#undef IEEE_MIN_NUM_MAG_R
381
382#define IEEE_QUIET_EQ_R(AKIND) \
383elemental logical function ieee_quiet_eq_a##AKIND(a, b); \
384real(AKIND), intent(in) :: a, b; \
385end function ieee_quiet_eq_a##AKIND;
386interface ieee_quiet_eq
387SPECIFICS_R(IEEE_QUIET_EQ_R)
388end interface ieee_quiet_eq
389public :: ieee_quiet_eq
390#undef IEEE_QUIET_EQ_R
391
392#define IEEE_QUIET_GE_R(AKIND) \
393elemental logical function ieee_quiet_ge_a##AKIND(a, b); \
394real(AKIND), intent(in) :: a, b; \
395end function ieee_quiet_ge_a##AKIND;
396interface ieee_quiet_ge
397SPECIFICS_R(IEEE_QUIET_GE_R)
398end interface ieee_quiet_ge
399public :: ieee_quiet_ge
400#undef IEEE_QUIET_GE_R
401
402#define IEEE_QUIET_GT_R(AKIND) \
403elemental logical function ieee_quiet_gt_a##AKIND(a, b); \
404real(AKIND), intent(in) :: a, b; \
405end function ieee_quiet_gt_a##AKIND;
406interface ieee_quiet_gt
407SPECIFICS_R(IEEE_QUIET_GT_R)
408end interface ieee_quiet_gt
409public :: ieee_quiet_gt
410#undef IEEE_QUIET_GT_R
411
412#define IEEE_QUIET_LE_R(AKIND) \
413elemental logical function ieee_quiet_le_a##AKIND(a, b); \
414real(AKIND), intent(in) :: a, b; \
415end function ieee_quiet_le_a##AKIND;
416interface ieee_quiet_le
417SPECIFICS_R(IEEE_QUIET_LE_R)
418end interface ieee_quiet_le
419public :: ieee_quiet_le
420#undef IEEE_QUIET_LE_R
421
422#define IEEE_QUIET_LT_R(AKIND) \
423elemental logical function ieee_quiet_lt_a##AKIND(a, b); \
424real(AKIND), intent(in) :: a, b; \
425end function ieee_quiet_lt_a##AKIND;
426interface ieee_quiet_lt
427SPECIFICS_R(IEEE_QUIET_LT_R)
428end interface ieee_quiet_lt
429public :: ieee_quiet_lt
430#undef IEEE_QUIET_LT_R
431
432#define IEEE_QUIET_NE_R(AKIND) \
433elemental logical function ieee_quiet_ne_a##AKIND(a, b); \
434real(AKIND), intent(in) :: a, b; \
435end function ieee_quiet_ne_a##AKIND;
436interface ieee_quiet_ne
437SPECIFICS_R(IEEE_QUIET_NE_R)
438end interface ieee_quiet_ne
439public :: ieee_quiet_ne
440#undef IEEE_QUIET_NE_R
441
442! When kind argument is present, kind(result) is value(kind), not kind(kind).
443! That is not known here, so return real(16).
444#define IEEE_REAL_I(AKIND) \
445elemental real function ieee_real_i##AKIND(a); \
446integer(AKIND), intent(in) :: a; \
447end function ieee_real_i##AKIND;
448#define IEEE_REAL_R(AKIND) \
449elemental real function ieee_real_a##AKIND(a); \
450real(AKIND), intent(in) :: a; \
451end function ieee_real_a##AKIND;
452#define IEEE_REAL_II(AKIND, KKIND) \
453elemental real(16) function ieee_real_i##AKIND##_i##KKIND(a, kind); \
454integer(AKIND), intent(in) :: a; \
455integer(KKIND), intent(in) :: kind; \
456end function ieee_real_i##AKIND##_i##KKIND;
457#define IEEE_REAL_RI(AKIND, KKIND) \
458elemental real(16) function ieee_real_a##AKIND##_i##KKIND(a, kind); \
459real(AKIND), intent(in) :: a; \
460integer(KKIND), intent(in) :: kind; \
461end function ieee_real_a##AKIND##_i##KKIND;
462interface ieee_real
463SPECIFICS_I(IEEE_REAL_I)
464SPECIFICS_R(IEEE_REAL_R)
465SPECIFICS_II(IEEE_REAL_II)
466SPECIFICS_RI(IEEE_REAL_RI)
467end interface ieee_real
468public :: ieee_real
469#undef IEEE_REAL_I
470#undef IEEE_REAL_R
471#undef IEEE_REAL_II
472#undef IEEE_REAL_RI
473
474#define IEEE_REM_RR(XKIND, YKIND) \
475elemental real(XKIND) function ieee_rem_a##XKIND##_a##YKIND(x, y); \
476real(XKIND), intent(in) :: x; \
477real(YKIND), intent(in) :: y; \
478end function ieee_rem_a##XKIND##_a##YKIND;
479interface ieee_rem
480SPECIFICS_RR(IEEE_REM_RR)
481end interface ieee_rem
482public :: ieee_rem
483#undef IEEE_REM_RR
484
485#define IEEE_RINT_R(XKIND) \
486elemental real(XKIND) function ieee_rint_a##XKIND(x, round); \
487import ieee_round_type; \
488real(XKIND), intent(in) :: x; \
489type(ieee_round_type), optional, intent(in) :: round; \
490end function ieee_rint_a##XKIND;
491interface ieee_rint
492SPECIFICS_R(IEEE_RINT_R)
493end interface ieee_rint
494public :: ieee_rint
495#undef IEEE_RINT_R
496
497#define IEEE_SET_ROUNDING_MODE_I(RKIND) \
498subroutine ieee_set_rounding_mode_i##RKIND(round_value, radix); \
499import ieee_round_type; \
500type(ieee_round_type), intent(in) :: round_value; \
501integer(RKIND), intent(in) :: radix; \
502end subroutine ieee_set_rounding_mode_i##RKIND;
503interface ieee_set_rounding_mode
504subroutine ieee_set_rounding_mode_0(round_value)
505import ieee_round_type
506type(ieee_round_type), intent(in) :: round_value
507end subroutine ieee_set_rounding_mode_0
508SPECIFICS_I(IEEE_SET_ROUNDING_MODE_I)
509end interface ieee_set_rounding_mode
510public :: ieee_set_rounding_mode
511#undef IEEE_SET_ROUNDING_MODE_I
512
513#define IEEE_SET_UNDERFLOW_MODE_L(GKIND) \
514subroutine ieee_set_underflow_mode_l##GKIND(gradual); \
515logical(GKIND), intent(in) :: gradual; \
516end subroutine ieee_set_underflow_mode_l##GKIND;
517interface ieee_set_underflow_mode
518SPECIFICS_L(IEEE_SET_UNDERFLOW_MODE_L)
519end interface ieee_set_underflow_mode
520public :: ieee_set_underflow_mode
521#undef IEEE_SET_UNDERFLOW_MODE_L
522
523#define IEEE_SIGNALING_EQ_R(AKIND) \
524elemental logical function ieee_signaling_eq_a##AKIND(a, b); \
525real(AKIND), intent(in) :: a, b; \
526end function ieee_signaling_eq_a##AKIND;
527interface ieee_signaling_eq
528SPECIFICS_R(IEEE_SIGNALING_EQ_R)
529end interface ieee_signaling_eq
530public :: ieee_signaling_eq
531#undef IEEE_SIGNALING_EQ_R
532
533#define IEEE_SIGNALING_GE_R(AKIND) \
534elemental logical function ieee_signaling_ge_a##AKIND(a, b); \
535real(AKIND), intent(in) :: a, b; \
536end function ieee_signaling_ge_a##AKIND;
537interface ieee_signaling_ge
538SPECIFICS_R(IEEE_SIGNALING_GE_R)
539end interface ieee_signaling_ge
540public :: ieee_signaling_ge
541#undef IEEE_SIGNALING_GE_R
542
543#define IEEE_SIGNALING_GT_R(AKIND) \
544elemental logical function ieee_signaling_gt_a##AKIND(a, b); \
545real(AKIND), intent(in) :: a, b; \
546end function ieee_signaling_gt_a##AKIND;
547interface ieee_signaling_gt
548SPECIFICS_R(IEEE_SIGNALING_GT_R)
549end interface ieee_signaling_gt
550public :: ieee_signaling_gt
551#undef IEEE_SIGNALING_GT_R
552
553#define IEEE_SIGNALING_LE_R(AKIND) \
554elemental logical function ieee_signaling_le_a##AKIND(a, b); \
555real(AKIND), intent(in) :: a, b; \
556end function ieee_signaling_le_a##AKIND;
557interface ieee_signaling_le
558SPECIFICS_R(IEEE_SIGNALING_LE_R)
559end interface ieee_signaling_le
560public :: ieee_signaling_le
561#undef IEEE_SIGNALING_LE_R
562
563#define IEEE_SIGNALING_LT_R(AKIND) \
564elemental logical function ieee_signaling_lt_a##AKIND(a, b); \
565real(AKIND), intent(in) :: a, b; \
566end function ieee_signaling_lt_a##AKIND;
567interface ieee_signaling_lt
568SPECIFICS_R(IEEE_SIGNALING_LT_R)
569end interface ieee_signaling_lt
570public :: ieee_signaling_lt
571#undef IEEE_SIGNALING_LT_R
572
573#define IEEE_SIGNALING_NE_R(AKIND) \
574elemental logical function ieee_signaling_ne_a##AKIND(a, b); \
575real(AKIND), intent(in) :: a, b; \
576end function ieee_signaling_ne_a##AKIND;
577interface ieee_signaling_ne
578SPECIFICS_R(IEEE_SIGNALING_NE_R)
579end interface ieee_signaling_ne
580public :: ieee_signaling_ne
581#undef IEEE_SIGNALING_NE_R
582
583#define IEEE_SIGNBIT_R(XKIND) \
584elemental logical function ieee_signbit_a##XKIND(x); \
585real(XKIND), intent(in) :: x; \
586end function ieee_signbit_a##XKIND;
587interface ieee_signbit
588SPECIFICS_R(IEEE_SIGNBIT_R)
589end interface ieee_signbit
590public :: ieee_signbit
591#undef IEEE_SIGNBIT_R
592
593#define IEEE_UNORDERED_RR(XKIND, YKIND) \
594elemental logical function ieee_unordered_a##XKIND##_a##YKIND(x, y); \
595real(XKIND), intent(in) :: x; \
596real(YKIND), intent(in) :: y; \
597end function ieee_unordered_a##XKIND##_a##YKIND;
598interface ieee_unordered
599SPECIFICS_RR(IEEE_UNORDERED_RR)
600end interface ieee_unordered
601public :: ieee_unordered
602#undef IEEE_UNORDERED_RR
603
604#define IEEE_VALUE_R(XKIND) \
605elemental real(XKIND) function ieee_value_a##XKIND(x, class); \
606import ieee_class_type; \
607real(XKIND), intent(in) :: x; \
608type(ieee_class_type), intent(in) :: class; \
609end function ieee_value_a##XKIND;
610interface ieee_value
611SPECIFICS_R(IEEE_VALUE_R)
612end interface ieee_value
613public :: ieee_value
614#undef IEEE_VALUE_R
615
616end module ieee_arithmetic
617