[libc-commits] [libc] [llvm] [libc]Add proxy header hdr/float-macros.h (PR #88674)

via libc-commits libc-commits at lists.llvm.org
Mon May 6 12:26:28 PDT 2024


https://github.com/aniplcc updated https://github.com/llvm/llvm-project/pull/88674

>From 46a907282d2468f3477ba06a687425b144810272 Mon Sep 17 00:00:00 2001
From: aniplcc <aniplccode at gmail.com>
Date: Mon, 15 Apr 2024 07:22:37 +0530
Subject: [PATCH 1/4] [libc]Add proxy header hdr/float-macros.h

---
 libc/hdr/CMakeLists.txt                       |  11 +-
 libc/hdr/float_macros.h                       | 168 ++++++++++++++++++
 libc/include/llvm-libc-macros/float-macros.h  | 163 ++++++++++-------
 .../macros/properties/CMakeLists.txt          |   2 +-
 libc/src/__support/macros/properties/types.h  |   2 +-
 .../llvm-project-overlay/libc/BUILD.bazel     |   9 +-
 6 files changed, 289 insertions(+), 66 deletions(-)
 create mode 100644 libc/hdr/float_macros.h

diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 179b05e6ee966d..74f5af1c01cf25 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -50,6 +50,15 @@ add_proxy_header_library(
     libc.include.fenv
 )
 
+add_proxy_header_library(
+  float_macros
+  HDRS
+    float_macros.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-macros.float_macros
+    libc.incude.float
+)
+
 add_proxy_header_library(
   signal_macros
   HDRS
@@ -67,5 +76,3 @@ add_proxy_header_library(
     libc.include.sys_epoll
     libc.include.llvm-libc-macros.sys_epoll_macros
 )
-
-add_subdirectory(types)
diff --git a/libc/hdr/float_macros.h b/libc/hdr/float_macros.h
new file mode 100644
index 00000000000000..c1d10f02f6987f
--- /dev/null
+++ b/libc/hdr/float_macros.h
@@ -0,0 +1,168 @@
+//===-- Definition of macros from float.h ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_FLOAT_MACROS_H
+#define LLVM_LIBC_HDR_FLOAT_MACROS_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-macros/float-macros.h"
+
+#else // Overlay mode
+
+#include <float.h>
+
+#ifndef FLT_RADIX
+#define FLT_RADIX __FLT_RADIX__
+#endif // FLT_RADIX
+
+#ifndef FLT_EVAL_METHOD
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif // FLT_EVAL_METHOD
+
+#ifndef DECIMAL_DIG
+#define DECIMAL_DIG __DECIMAL_DIG__
+#endif // DECIMAL_DIG
+
+#ifndef FLT_DECIMAL_DIG
+#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
+#endif // FLT_DECIMAL_DIG
+
+#ifndef DBL_DECIMAL_DIG
+#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
+#endif // DBL_DECIMAL_DIG
+
+#ifndef LDBL_DECIMAL_DIG
+#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#endif // LDBL_DECIMAL_DIG
+
+#ifndef FLT_DIG
+#define FLT_DIG __FLT_DIG__
+#endif // FLT_DIG
+
+#ifndef DBL_DIG
+#define DBL_DIG __DBL_DIG__
+#endif // DBL_DIG
+
+#ifndef LDBL_DIG
+#define LDBL_DIG __LDBL_DIG__
+#endif // LDBL_DIG
+
+#ifndef FLT_MANT_DIG
+#define FLT_MANT_DIG __FLT_MANT_DIG__
+#endif // FLT_MANT_DIG
+
+#ifndef DBL_MANT_DIG
+#define DBL_MANT_DIG __DBL_MANT_DIG__
+#endif // DBL_MANT_DIG
+
+#ifndef LDBL_MANT_DIG
+#define LDBL_MANT_DIG __LDBL_MANT_DIG__
+#endif // LDBL_MANT_DIG
+
+#ifndef FLT_MIN
+#define FLT_MIN __FLT_MIN__
+#endif // FLT_MIN
+
+#ifndef DBL_MIN
+#define DBL_MIN __DBL_MIN__
+#endif // DBL_MIN
+
+#ifndef LDBL_MIN
+#define LDBL_MIN __LDBL_MIN__
+#endif // LDBL_MIN
+
+#ifndef FLT_MAX
+#define FLT_MAX __FLT_MAX__
+#endif // FLT_MAX
+
+#ifndef DBL_MAX
+#define DBL_MAX __DBL_MAX__
+#endif // DBL_MAX
+
+#ifndef LDBL_MAX
+#define LDBL_MAX __LDBL_MAX__
+#endif // LDBL_MAX
+
+#ifndef FLT_TRUE_MIN
+#define FLT_TRUE_MIN __FLT_TRUE_MIN__
+#endif // FLT_TRUE_MIN
+
+#ifndef DBL_TRUE_MIN
+#define DBL_TRUE_MIN __DBL_TRUE_MIN__
+#endif // DBL_TRUE_MIN
+
+#ifndef LDBL_TRUE_MIN
+#define LDBL_TRUE_MIN __LDBL_TRUE_MIN__
+#endif // LDBL_TRUE_MIN
+
+#ifndef FLT_EPSILON
+#define FLT_EPSILON __FLT_EPSILON__
+#endif // FLT_EPSILON
+
+#ifndef DBL_EPSILON
+#define DBL_EPSILON __DBL_EPSILON__
+#endif // DBL_EPSILON
+
+#ifndef LDBL_EPSILON
+#define LDBL_EPSILON __LDBL_EPSILON__
+#endif // LDBL_EPSILON
+
+#ifndef FLT_MIN_EXP
+#define FLT_MIN_EXP __FLT_MIN_EXP__
+#endif // FLT_MIN_EXP
+
+#ifndef DBL_MIN_EXP
+#define DBL_MIN_EXP __DBL_MIN_EXP__
+#endif // DBL_MIN_EXP
+
+#ifndef LDBL_MIN_EXP
+#define LDBL_MIN_EXP __LDBL_MIN_EXP__
+#endif // LDBL_MIN_EXP
+
+#ifndef FLT_MIN_10_EXP
+#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
+#endif // FLT_MIN_10_EXP
+
+#ifndef DBL_MIN_10_EXP
+#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
+#endif // DBL_MIN_10_EXP
+
+#ifndef LDBL_MIN_10_EXP
+#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
+#endif // LDBL_MIN_10_EXP
+
+#ifndef FLT_MAX_EXP
+#define FLT_MAX_EXP __FLT_MAX_EXP__
+#endif // FLT_MAX_EXP
+
+#ifndef DBL_MAX_EXP
+#define DBL_MAX_EXP __DBL_MAX_EXP__
+#endif // DBL_MAX_EXP
+
+#ifndef LDBL_MAX_EXP
+#define LDBL_MAX_EXP __LDBL_MAX_EXP__
+#endif // LDBL_MAX_EXP
+
+#ifndef FLT_MAX_10_EXP
+#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
+#endif // FLT_MAX_10_EXP
+
+#ifndef DBL_MAX_10_EXP
+#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
+#endif // DBL_MAX_10_EXP
+
+#ifndef LDBL_MAX_10_EXP
+#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
+#endif // LDBL_MAX_10_EXP
+
+// TODO: Add FLT16 and FLT128 constants.
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_FLOAT_MACROS_H
diff --git a/libc/include/llvm-libc-macros/float-macros.h b/libc/include/llvm-libc-macros/float-macros.h
index 4fe8590c5f70c8..0f15b909eb19ac 100644
--- a/libc/include/llvm-libc-macros/float-macros.h
+++ b/libc/include/llvm-libc-macros/float-macros.h
@@ -9,163 +9,206 @@
 #ifndef LLVM_LIBC_MACROS_FLOAT_MACROS_H
 #define LLVM_LIBC_MACROS_FLOAT_MACROS_H
 
-// Suppress `#include_next is a language extension` warnings.
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu-include-next"
-#pragma clang diagnostic ignored "-Winclude-next-absolute-path"
-#else // gcc
-#pragma GCC system_header
-#endif //__clang__
-
-#include_next <float.h>
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif //__clang__
-
-#ifndef FLT_RADIX
+#ifdef __FLT_RADIX__
 #define FLT_RADIX __FLT_RADIX__
+#else 
+#define FLT_RADIX 2
 #endif // FLT_RADIX
 
-#ifndef FLT_EVAL_METHOD
+#ifdef FLT_EVAL_METHOD
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
 #endif // FLT_EVAL_METHOD
 
-#ifndef DECIMAL_DIG
+#ifdef DECIMAL_DIG
 #define DECIMAL_DIG __DECIMAL_DIG__
+#else 
+#define DECIMAL_DIG 10
 #endif // DECIMAL_DIG
 
-#ifndef FLT_DECIMAL_DIG
+#ifdef FLT_DECIMAL_DIG 
 #define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
+#else 
+#define FLT_DECIMAL_DIG 6
 #endif // FLT_DECIMAL_DIG
 
-#ifndef DBL_DECIMAL_DIG
+#ifdef DBL_DECIMAL_DIG
 #define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
+#else 
+#define DBL_DECIMAL_DIG 10
 #endif // DBL_DECIMAL_DIG
 
-#ifndef LDBL_DECIMAL_DIG
+#ifdef LDBL_DECIMAL_DIG
 #define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#else 
+#define LDBL_DECIMAL_DIG 10
 #endif // LDBL_DECIMAL_DIG
 
-#ifndef FLT_DIG
+#ifdef FLT_DIG
 #define FLT_DIG __FLT_DIG__
+#else 
+#define FLT_DIG 6
 #endif // FLT_DIG
 
-#ifndef DBL_DIG
+#ifdef DBL_DIG
 #define DBL_DIG __DBL_DIG__
+#else 
+#define DBL_DIG 10
 #endif // DBL_DIG
 
-#ifndef LDBL_DIG
+#ifdef LDBL_DIG
 #define LDBL_DIG __LDBL_DIG__
+#else 
+#define LDBL_DIG 10
 #endif // LDBL_DIG
 
-#ifndef FLT_MANT_DIG
+#ifdef FLT_MANT_DIG
 #define FLT_MANT_DIG __FLT_MANT_DIG__
+#else 
+#define FLT_MANT_DIG 24
 #endif // FLT_MANT_DIG
 
-#ifndef DBL_MANT_DIG
+#ifdef DBL_MANT_DIG
 #define DBL_MANT_DIG __DBL_MANT_DIG__
+#else 
+#define DBL_MANT_DIG 53
 #endif // DBL_MANT_DIG
 
-#ifndef LDBL_MANT_DIG
+#ifdef LDBL_MANT_DIG
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
+#else 
+#define LDBL_MANT_DIG 113
 #endif // LDBL_MANT_DIG
 
-#ifndef FLT_MIN
+#ifdef FLT_MIN
 #define FLT_MIN __FLT_MIN__
+#else 
+#define FLT_MIN 1E-37
 #endif // FLT_MIN
 
-#ifndef DBL_MIN
+#ifdef DBL_MIN
 #define DBL_MIN __DBL_MIN__
+#else 
+#define DBL_MIN 1E-37
 #endif // DBL_MIN
 
-#ifndef LDBL_MIN
+#ifdef LDBL_MIN
 #define LDBL_MIN __LDBL_MIN__
+#else 
+#define LDBL_MIN 1E-37  
 #endif // LDBL_MIN
 
-#ifndef FLT_MAX
+#ifdef FLT_MAX
 #define FLT_MAX __FLT_MAX__
+#else 
+#define FLT_MAX 1E+37
 #endif // FLT_MAX
 
-#ifndef DBL_MAX
+#ifdef DBL_MAX
 #define DBL_MAX __DBL_MAX__
+#else 
+#define DBL_MAX 1E+37
 #endif // DBL_MAX
 
-#ifndef LDBL_MAX
+#ifdef LDBL_MAX
 #define LDBL_MAX __LDBL_MAX__
+#else 
+#define LDBL_MAX 1E+37
 #endif // LDBL_MAX
 
-#ifndef FLT_TRUE_MIN
-#define FLT_TRUE_MIN __FLT_TRUE_MIN__
-#endif // FLT_TRUE_MIN
-
-#ifndef DBL_TRUE_MIN
-#define DBL_TRUE_MIN __DBL_TRUE_MIN__
-#endif // DBL_TRUE_MIN
-
-#ifndef LDBL_TRUE_MIN
-#define LDBL_TRUE_MIN __LDBL_TRUE_MIN__
-#endif // LDBL_TRUE_MIN
-
-#ifndef FLT_EPSILON
+// #ifdef FLT_TRUE_MIN
+// #define FLT_TRUE_MIN __FLT_DNORM_MIN //acc to Clang's define [remove after review]
+// #else 
+// #define FLT_TRUE_MIN 1E-37
+// #endif // FLT_TRUE_MIN
+// 
+// #ifdef DBL_TRUE_MIN
+// #define DBL_TRUE_MIN __DBL_DENORM_MIN__ //acc to Clang's define [remove after review] 
+// #else 
+// #define DBL_TRUE_MIN 1E-37
+// #endif // DBL_TRUE_MIN
+// 
+// #ifdef LDBL_TRUE_MIN
+// #define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ //acc to Clang's define [remove after review] 
+// #else 
+// #define LDBL_TRUE_MIN 1E-37  
+// #endif // LDBL_TRUE_MIN
+
+#ifdef FLT_EPSILON
 #define FLT_EPSILON __FLT_EPSILON__
+#else 
+#define FLT_EPSILON 1E-5 
 #endif // FLT_EPSILON
 
-#ifndef DBL_EPSILON
+#ifdef DBL_EPSILON
 #define DBL_EPSILON __DBL_EPSILON__
+#else 
+#define DBL_EPSILON 1E-9
 #endif // DBL_EPSILON
 
-#ifndef LDBL_EPSILON
+#ifdef LDBL_EPSILON
 #define LDBL_EPSILON __LDBL_EPSILON__
+#else 
+#define LDBL_EPSILON 1E-9
 #endif // LDBL_EPSILON
 
-#ifndef FLT_MIN_EXP
+#ifdef FLT_MIN_EXP
 #define FLT_MIN_EXP __FLT_MIN_EXP__
 #endif // FLT_MIN_EXP
 
-#ifndef DBL_MIN_EXP
+#ifdef DBL_MIN_EXP
 #define DBL_MIN_EXP __DBL_MIN_EXP__
 #endif // DBL_MIN_EXP
 
-#ifndef LDBL_MIN_EXP
+#ifdef LDBL_MIN_EXP
 #define LDBL_MIN_EXP __LDBL_MIN_EXP__
 #endif // LDBL_MIN_EXP
 
-#ifndef FLT_MIN_10_EXP
+#ifdef FLT_MIN_10_EXP
 #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
+#else 
+#define FLT_MIN_10_EXP -37
 #endif // FLT_MIN_10_EXP
 
-#ifndef DBL_MIN_10_EXP
+#ifdef DBL_MIN_10_EXP
 #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
+#else 
+#define DBL_MIN_10_EXP -37
 #endif // DBL_MIN_10_EXP
 
-#ifndef LDBL_MIN_10_EXP
+#ifdef LDBL_MIN_10_EXP
 #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
+#else 
+#define LDBL_MIN_10_EXP -37
 #endif // LDBL_MIN_10_EXP
 
-#ifndef FLT_MAX_EXP
+#ifdef FLT_MAX_EXP
 #define FLT_MAX_EXP __FLT_MAX_EXP__
 #endif // FLT_MAX_EXP
 
-#ifndef DBL_MAX_EXP
+#ifdef DBL_MAX_EXP
 #define DBL_MAX_EXP __DBL_MAX_EXP__
 #endif // DBL_MAX_EXP
 
-#ifndef LDBL_MAX_EXP
+#ifdef LDBL_MAX_EXP
 #define LDBL_MAX_EXP __LDBL_MAX_EXP__
 #endif // LDBL_MAX_EXP
 
-#ifndef FLT_MAX_10_EXP
+#ifdef FLT_MAX_10_EXP
 #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
+#else 
+#define FLT_MAX_10_EXP +37
 #endif // FLT_MAX_10_EXP
 
-#ifndef DBL_MAX_10_EXP
+#ifdef DBL_MAX_10_EXP
 #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
+#else 
+#define DBL_MAX_10_EXP +37
 #endif // DBL_MAX_10_EXP
 
-#ifndef LDBL_MAX_10_EXP
+#ifdef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
+#else 
+#define LDBL_MAX_10_EXP +37
 #endif // LDBL_MAX_10_EXP
 
 // TODO: Add FLT16 and FLT128 constants.
diff --git a/libc/src/__support/macros/properties/CMakeLists.txt b/libc/src/__support/macros/properties/CMakeLists.txt
index bbc45650f3fca3..7718aeaa3de5af 100644
--- a/libc/src/__support/macros/properties/CMakeLists.txt
+++ b/libc/src/__support/macros/properties/CMakeLists.txt
@@ -33,6 +33,6 @@ add_header_library(
     .compiler
     .cpu_features
     .os
-    libc.include.llvm-libc-macros.float_macros
+    libc.hdr.float_macros
     libc.include.llvm-libc-types.float128
 )
diff --git a/libc/src/__support/macros/properties/types.h b/libc/src/__support/macros/properties/types.h
index d43cf99e6859be..0e75af15849935 100644
--- a/libc/src/__support/macros/properties/types.h
+++ b/libc/src/__support/macros/properties/types.h
@@ -10,7 +10,7 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H
 #define LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H
 
-#include "include/llvm-libc-macros/float-macros.h" // LDBL_MANT_DIG
+#include "hdr/float_macros.h" // LDBL_MANT_DIG
 #include "include/llvm-libc-types/float128.h"      // float128
 #include "src/__support/macros/properties/architectures.h"
 #include "src/__support/macros/properties/compiler.h"
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index aa9f665c350ae3..d72ab95e3ae05a 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -87,7 +87,7 @@ libc_support_library(
         "@platforms//os:linux": [],
         "//conditions:default": ["@platforms//:incompatible"],
     }),
-    deps = [":llvm_libc_macros_float_macros"],
+    deps = ["include/llvm-libc-macros/linux/float-macros.h"],
 )
 
 libc_support_library(
@@ -107,6 +107,11 @@ libc_support_library(
     hdrs = ["hdr/fenv_macros.h"],
 )
 
+libc_support_library(
+    name = "hdr_float_macros",
+    hdrs = ["hdr/float_macros.h"],
+)
+
 libc_support_library(
     name = "hdr_signal_macros",
     hdrs = ["hdr/signal_macros.h"],
@@ -169,7 +174,7 @@ libc_support_library(
         ":__support_macros_properties_compiler",
         ":__support_macros_properties_cpu_features",
         ":__support_macros_properties_os",
-        ":llvm_libc_macros_float_macros",
+        ":hdr_float_macros",
         ":llvm_libc_types_float128",
     ],
 )

>From 4028338ba7ed21e2eb59e6709bdc69f88d8ee13b Mon Sep 17 00:00:00 2001
From: aniplcc <aniplccode at gmail.com>
Date: Mon, 15 Apr 2024 07:37:06 +0530
Subject: [PATCH 2/4] fix CMakeLists.txt

---
 libc/hdr/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 74f5af1c01cf25..8d82534a849727 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -76,3 +76,5 @@ add_proxy_header_library(
     libc.include.sys_epoll
     libc.include.llvm-libc-macros.sys_epoll_macros
 )
+
+add_subdirectory(types)

>From 1d8c6cecddd94692d7cdd7f4b320e4b38f545278 Mon Sep 17 00:00:00 2001
From: aniplcc <aniplccode at gmail.com>
Date: Mon, 15 Apr 2024 07:38:14 +0530
Subject: [PATCH 3/4] format fix

---
 libc/hdr/float_macros.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/hdr/float_macros.h b/libc/hdr/float_macros.h
index c1d10f02f6987f..03050e0fcaca78 100644
--- a/libc/hdr/float_macros.h
+++ b/libc/hdr/float_macros.h
@@ -1,4 +1,4 @@
-//===-- Definition of macros from float.h ----------------------------------===//
+//===-- Definition of macros from float.h ---------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

>From cb60881b946d1e0821db0d13c7630586e87ae434 Mon Sep 17 00:00:00 2001
From: aniplcc <aniplccode at gmail.com>
Date: Tue, 7 May 2024 00:53:09 +0530
Subject: [PATCH 4/4] Update float-macros.h with IEC-60559 definitions

---
 libc/include/llvm-libc-macros/float-macros.h | 155 +++++++++++--------
 1 file changed, 94 insertions(+), 61 deletions(-)

diff --git a/libc/include/llvm-libc-macros/float-macros.h b/libc/include/llvm-libc-macros/float-macros.h
index 0f15b909eb19ac..23a8bd8acf84dd 100644
--- a/libc/include/llvm-libc-macros/float-macros.h
+++ b/libc/include/llvm-libc-macros/float-macros.h
@@ -11,206 +11,239 @@
 
 #ifdef __FLT_RADIX__
 #define FLT_RADIX __FLT_RADIX__
-#else 
+#else
 #define FLT_RADIX 2
 #endif // FLT_RADIX
 
-#ifdef FLT_EVAL_METHOD
-#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#endif // FLT_EVAL_METHOD
+// #ifdef FLT_EVAL_METHOD
+// #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+// #endif // FLT_EVAL_METHOD
+// #define FLT_EVAL_METHOD 0
+//clarifiy
 
 #ifdef DECIMAL_DIG
 #define DECIMAL_DIG __DECIMAL_DIG__
-#else 
+#else
 #define DECIMAL_DIG 10
 #endif // DECIMAL_DIG
+//clarify
 
-#ifdef FLT_DECIMAL_DIG 
+#ifdef FLT_DECIMAL_DIG
 #define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
-#else 
-#define FLT_DECIMAL_DIG 6
+#else
+#define FLT_DECIMAL_DIG 9
 #endif // FLT_DECIMAL_DIG
 
 #ifdef DBL_DECIMAL_DIG
 #define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
-#else 
-#define DBL_DECIMAL_DIG 10
+#else
+#define DBL_DECIMAL_DIG 17
 #endif // DBL_DECIMAL_DIG
 
 #ifdef LDBL_DECIMAL_DIG
 #define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
-#else 
+#else
 #define LDBL_DECIMAL_DIG 10
 #endif // LDBL_DECIMAL_DIG
+//clarify
 
 #ifdef FLT_DIG
 #define FLT_DIG __FLT_DIG__
-#else 
+#else
 #define FLT_DIG 6
 #endif // FLT_DIG
 
 #ifdef DBL_DIG
 #define DBL_DIG __DBL_DIG__
-#else 
-#define DBL_DIG 10
+#else
+#define DBL_DIG 15
 #endif // DBL_DIG
 
 #ifdef LDBL_DIG
 #define LDBL_DIG __LDBL_DIG__
-#else 
+#else
 #define LDBL_DIG 10
 #endif // LDBL_DIG
+//clarify
 
 #ifdef FLT_MANT_DIG
 #define FLT_MANT_DIG __FLT_MANT_DIG__
-#else 
+#else
 #define FLT_MANT_DIG 24
 #endif // FLT_MANT_DIG
 
 #ifdef DBL_MANT_DIG
 #define DBL_MANT_DIG __DBL_MANT_DIG__
-#else 
+#else
 #define DBL_MANT_DIG 53
 #endif // DBL_MANT_DIG
 
 #ifdef LDBL_MANT_DIG
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
-#else 
+#else
 #define LDBL_MANT_DIG 113
 #endif // LDBL_MANT_DIG
+//clarify
 
 #ifdef FLT_MIN
 #define FLT_MIN __FLT_MIN__
-#else 
-#define FLT_MIN 1E-37
+#else
+#define FLT_MIN 1.17549435082228750796873653722224568e-38F
 #endif // FLT_MIN
 
 #ifdef DBL_MIN
 #define DBL_MIN __DBL_MIN__
-#else 
-#define DBL_MIN 1E-37
+#else
+#define DBL_MIN 2.22507385850720138309023271733240406e-308L
 #endif // DBL_MIN
 
 #ifdef LDBL_MIN
 #define LDBL_MIN __LDBL_MIN__
-#else 
-#define LDBL_MIN 1E-37  
+#else
+#define LDBL_MIN 1E-37
 #endif // LDBL_MIN
+//clarify
 
 #ifdef FLT_MAX
 #define FLT_MAX __FLT_MAX__
-#else 
-#define FLT_MAX 1E+37
+#else
+#define FLT_MAX 3.40282346638528859811704183484516925e+38F
 #endif // FLT_MAX
 
 #ifdef DBL_MAX
 #define DBL_MAX __DBL_MAX__
-#else 
-#define DBL_MAX 1E+37
+#else
+#define DBL_MAX 1.79769313486231570814527423731704357e+308L
 #endif // DBL_MAX
 
 #ifdef LDBL_MAX
 #define LDBL_MAX __LDBL_MAX__
-#else 
+#else
 #define LDBL_MAX 1E+37
 #endif // LDBL_MAX
+//clarify
+
+#ifdef FLT_TRUE_MIN
+#define FLT_TRUE_MIN __FLT_DNORM_MIN 
+#else 
+#define FLT_TRUE_MIN 1.40129846432481707092372958328991613e-45F 
+#endif // FLT_TRUE_MIN
 
-// #ifdef FLT_TRUE_MIN
-// #define FLT_TRUE_MIN __FLT_DNORM_MIN //acc to Clang's define [remove after review]
-// #else 
-// #define FLT_TRUE_MIN 1E-37
-// #endif // FLT_TRUE_MIN
-// 
-// #ifdef DBL_TRUE_MIN
-// #define DBL_TRUE_MIN __DBL_DENORM_MIN__ //acc to Clang's define [remove after review] 
-// #else 
-// #define DBL_TRUE_MIN 1E-37
-// #endif // DBL_TRUE_MIN
-// 
-// #ifdef LDBL_TRUE_MIN
-// #define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ //acc to Clang's define [remove after review] 
-// #else 
-// #define LDBL_TRUE_MIN 1E-37  
-// #endif // LDBL_TRUE_MIN
+#ifdef DBL_TRUE_MIN
+#define DBL_TRUE_MIN __DBL_DENORM_MIN__ 
+#else 
+#define DBL_TRUE_MIN 4.94065645841246544176568792868221372e-324L 
+#endif // DBL_TRUE_MIN
+
+#ifdef LDBL_TRUE_MIN
+#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ 
+#else 
+#define LDBL_TRUE_MIN 1E-37 
+#endif // LDBL_TRUE_MIN
+//clarify
 
 #ifdef FLT_EPSILON
 #define FLT_EPSILON __FLT_EPSILON__
-#else 
-#define FLT_EPSILON 1E-5 
+#else
+#define FLT_EPSILON 1.1920928955078125e-7F
 #endif // FLT_EPSILON
 
 #ifdef DBL_EPSILON
 #define DBL_EPSILON __DBL_EPSILON__
-#else 
-#define DBL_EPSILON 1E-9
+#else
+#define DBL_EPSILON 2.22044604925031308084726333618164062e-16L 
 #endif // DBL_EPSILON
 
 #ifdef LDBL_EPSILON
 #define LDBL_EPSILON __LDBL_EPSILON__
-#else 
+#else
 #define LDBL_EPSILON 1E-9
 #endif // LDBL_EPSILON
+//clarify
 
 #ifdef FLT_MIN_EXP
 #define FLT_MIN_EXP __FLT_MIN_EXP__
+#else 
+#define FLT_MIN_EXP (-125)
 #endif // FLT_MIN_EXP
 
 #ifdef DBL_MIN_EXP
 #define DBL_MIN_EXP __DBL_MIN_EXP__
+#else
+#define DBL_MIN_EXP (-1021)
 #endif // DBL_MIN_EXP
 
 #ifdef LDBL_MIN_EXP
 #define LDBL_MIN_EXP __LDBL_MIN_EXP__
 #endif // LDBL_MIN_EXP
+//clarify
 
 #ifdef FLT_MIN_10_EXP
 #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
-#else 
-#define FLT_MIN_10_EXP -37
+#else
+#define FLT_MIN_10_EXP (-37)
 #endif // FLT_MIN_10_EXP
 
 #ifdef DBL_MIN_10_EXP
 #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
-#else 
-#define DBL_MIN_10_EXP -37
+#else
+#define DBL_MIN_10_EXP (-307)
 #endif // DBL_MIN_10_EXP
 
 #ifdef LDBL_MIN_10_EXP
 #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
-#else 
+#else
 #define LDBL_MIN_10_EXP -37
 #endif // LDBL_MIN_10_EXP
+//clarify
 
 #ifdef FLT_MAX_EXP
 #define FLT_MAX_EXP __FLT_MAX_EXP__
+#else
+#define FLT_MAX_EXP 128
 #endif // FLT_MAX_EXP
 
 #ifdef DBL_MAX_EXP
 #define DBL_MAX_EXP __DBL_MAX_EXP__
+#else
+#define DBL_MAX_EXP 1024
 #endif // DBL_MAX_EXP
 
 #ifdef LDBL_MAX_EXP
 #define LDBL_MAX_EXP __LDBL_MAX_EXP__
 #endif // LDBL_MAX_EXP
+//clarify
 
 #ifdef FLT_MAX_10_EXP
 #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
-#else 
-#define FLT_MAX_10_EXP +37
+#else
+#define FLT_MAX_10_EXP 38
 #endif // FLT_MAX_10_EXP
 
 #ifdef DBL_MAX_10_EXP
 #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
-#else 
-#define DBL_MAX_10_EXP +37
+#else
+#define DBL_MAX_10_EXP 308
 #endif // DBL_MAX_10_EXP
 
 #ifdef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
-#else 
+#else
 #define LDBL_MAX_10_EXP +37
 #endif // LDBL_MAX_10_EXP
 
+#if defined(LIBC_TARGET_ARCH_IS_RISCV64) || defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
+
+#endif
+
+#if defined(LIBC_TARGET_ARCH_IS_X86_32)
+
+#endif
+
+#if defined(LIBC_TARGET_ARCH_IS_X86_64)
+
+#endif
+
 // TODO: Add FLT16 and FLT128 constants.
 
 #endif // LLVM_LIBC_MACROS_FLOAT_MACROS_H



More information about the libc-commits mailing list