> 
> So we either have the make FP_ILOGB0 machine dependent, or change some
> of the implementations.

Here is my patch for the first option, tested on arm64.


John


Index: include/math.h
===================================================================
RCS file: /cvs/src/include/math.h,v
retrieving revision 1.36
diff -u -r1.36 math.h
--- include/math.h      10 Mar 2018 20:52:58 -0000      1.36
+++ include/math.h      30 Oct 2020 21:31:55 -0000
@@ -56,8 +56,14 @@
 #define        FP_NORMAL       0x04
 #define        FP_SUBNORMAL    0x08
 #define        FP_ZERO         0x10
-
-#define FP_ILOGB0      (-INT_MAX)
+/*
+ * ISO C permits either value; choose based on arch
+ */
+#if defined(__i386) || defined(__amd64)
+#define FP_ILOGB0      (INT_MIN)
+#else
+#define FP_ILOGB0       (-INT_MAX)
+#endif
 #define FP_ILOGBNAN    INT_MAX
 
 #ifdef __FP_FAST_FMA
Index: lib/libm/man/ilogb.3
===================================================================
RCS file: /cvs/src/lib/libm/man/ilogb.3,v
retrieving revision 1.7
diff -u -r1.7 ilogb.3
--- lib/libm/man/ilogb.3        26 Apr 2016 19:49:22 -0000      1.7
+++ lib/libm/man/ilogb.3        30 Oct 2020 21:31:55 -0000
@@ -56,7 +56,7 @@
 and
 .Fn ilogb 0
 returns
-.Dv INT_MIN .
+.Dv FP_ILOGB0 .
 The
 .Fn ilogbf
 function is a single precision version of

Reply via email to