1From 9b972aaf435f15ce82b9f3dc006877d6cdd04592 Mon Sep 17 00:00:00 2001
2From: Michael Forney <mforney@mforney.org>
3Date: Thu, 30 Sep 2021 22:21:25 -0700
4Subject: [PATCH] avoid inline functions involving long double in math.h
5
6---
7 include/math.h | 11 ++++++-----
8 src/math/__isgreaterequall.c | 6 ++++++
9 src/math/__isgreaterl.c | 6 ++++++
10 src/math/__islessequall.c | 6 ++++++
11 src/math/__islessgreaterl.c | 6 ++++++
12 src/math/__islessl.c | 6 ++++++
13 6 files changed, 36 insertions(+), 5 deletions(-)
14 create mode 100644 src/math/__isgreaterequall.c
15 create mode 100644 src/math/__isgreaterl.c
16 create mode 100644 src/math/__islessequall.c
17 create mode 100644 src/math/__islessgreaterl.c
18 create mode 100644 src/math/__islessl.c
19
20diff --git a/include/math.h b/include/math.h
21index 14f28ec8..0286fba4 100644
22--- a/include/math.h
23+++ b/include/math.h
24@@ -107,19 +107,20 @@ static __inline int __is##rel(type __x, type __y) \
25
26 __ISREL_DEF(lessf, <, float_t)
27 __ISREL_DEF(less, <, double_t)
28-__ISREL_DEF(lessl, <, long double)
29 __ISREL_DEF(lessequalf, <=, float_t)
30 __ISREL_DEF(lessequal, <=, double_t)
31-__ISREL_DEF(lessequall, <=, long double)
32 __ISREL_DEF(lessgreaterf, !=, float_t)
33 __ISREL_DEF(lessgreater, !=, double_t)
34-__ISREL_DEF(lessgreaterl, !=, long double)
35 __ISREL_DEF(greaterf, >, float_t)
36 __ISREL_DEF(greater, >, double_t)
37-__ISREL_DEF(greaterl, >, long double)
38 __ISREL_DEF(greaterequalf, >=, float_t)
39 __ISREL_DEF(greaterequal, >=, double_t)
40-__ISREL_DEF(greaterequall, >=, long double)
41+
42+int __islessl(long double, long double);
43+int __islessequall(long double, long double);
44+int __islessgreaterl(long double, long double);
45+int __isgreaterl(long double, long double);
46+int __isgreaterequall(long double, long double);
47
48 #define __tg_pred_2(x, y, p) ( \
49 sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \
50diff --git a/src/math/__isgreaterequall.c b/src/math/__isgreaterequall.c
51new file mode 100644
52index 00000000..2d014213
53--- /dev/null
54+++ b/src/math/__isgreaterequall.c
55@@ -0,0 +1,6 @@
56+#include <math.h>
57+
58+int __isgreaterequall(long double x, long double y)
59+{
60+ return !isunordered(x, y) && x >= y;
61+}
62diff --git a/src/math/__isgreaterl.c b/src/math/__isgreaterl.c
63new file mode 100644
64index 00000000..835fe575
65--- /dev/null
66+++ b/src/math/__isgreaterl.c
67@@ -0,0 +1,6 @@
68+#include <math.h>
69+
70+int __isgreaterl(long double x, long double y)
71+{
72+ return !isunordered(x, y) && x > y;
73+}
74diff --git a/src/math/__islessequall.c b/src/math/__islessequall.c
75new file mode 100644
76index 00000000..3534ab5b
77--- /dev/null
78+++ b/src/math/__islessequall.c
79@@ -0,0 +1,6 @@
80+#include <math.h>
81+
82+int __islessequall(long double x, long double y)
83+{
84+ return !isunordered(x, y) && x <= y;
85+}
86diff --git a/src/math/__islessgreaterl.c b/src/math/__islessgreaterl.c
87new file mode 100644
88index 00000000..e8543384
89--- /dev/null
90+++ b/src/math/__islessgreaterl.c
91@@ -0,0 +1,6 @@
92+#include <math.h>
93+
94+int __islessgreaterl(long double x, long double y)
95+{
96+ return !isunordered(x, y) && x != y;
97+}
98diff --git a/src/math/__islessl.c b/src/math/__islessl.c
99new file mode 100644
100index 00000000..27b48d0e
101--- /dev/null
102+++ b/src/math/__islessl.c
103@@ -0,0 +1,6 @@
104+#include <math.h>
105+
106+int __islessl(long double x, long double y)
107+{
108+ return !isunordered(x, y) && x < y;
109+}
110--
1112.32.0
112