aboutsummaryrefslogtreecommitdiff
path: root/libgcobol/libgcobol-fp.h
diff options
context:
space:
mode:
Diffstat (limited to 'libgcobol/libgcobol-fp.h')
-rw-r--r--libgcobol/libgcobol-fp.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/libgcobol/libgcobol-fp.h b/libgcobol/libgcobol-fp.h
new file mode 100644
index 0000000..bd443f3
--- /dev/null
+++ b/libgcobol/libgcobol-fp.h
@@ -0,0 +1,50 @@
+/* Copyright The GNU Toolchain Authors. */
+
+/* This file is part of the GNU COBOL runtime library (libgcobol).
+
+libgcobol is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 3 of the License, or (at your option) any later version.
+
+libgcobol is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* You must include "config.h" before this file. */
+
+#if __LDBL_MANT_DIG__ == 113 && __LDBL_MIN_EXP__ == -16381
+// Use long double, l suffix on calls, l or L suffix in literals
+# define GCOB_FP128 long double
+# define GCOB_FP128_LITERAL(lit) (lit ## l)
+# define FP128_FUNC(funcname) funcname ## l
+#elif __FLT128_MANT_DIG__ == 113 && __FLT128_MIN_EXP__ == -16381 \
+ && defined(USE_IEC_60559)
+// Use _Float128, f128 suffix on calls, f128 or F128 suffix on literals
+# define GCOB_FP128 _Float128
+# define GCOB_FP128_LITERAL(lit) (lit ## f128)
+# define FP128_FUNC(funcname) funcname ## f128
+#elif __FLT128_MANT_DIG__ == 113 && __FLT128_MIN_EXP__ == -16381
+// Use __float128, q suffix on calls, q or Q suffix on literals
+# define GCOB_FP128 __float128
+# define GCOB_FP128_LITERAL(lit) (lit ## q)
+# define FP128_FUNC(funcname) funcname ## q
+#else
+# error "libgcobol requires 128b floating point"
+#endif
+
+#if USE_QUADMATH
+/* We will assume that unless we found the 128 to/from string and some
+ representative trig functions, we need libquadmath to support those. */
+# include "quadmath.h"
+#endif