bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OpenBSD frexpl failure


From: Eric Blake
Subject: Re: OpenBSD frexpl failure
Date: Wed, 05 Dec 2007 21:08:31 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

According to Bruno Haible on 12/5/2007 2:59 PM:
> Eric Blake wrote:
>> it appears that <float.h> is botched for OpenBSD 4.0, since
>> the above makes it clear that long double occupies 80 bits with a 15-bit
>> exponent field, ...
>> It looks like float.in.h needs to be updated to cater for another platform
>> with a broken <float.h>.
> 
> Can you try it out (change float_h.m4, float.in.h, and then run a testdir with
> tests from frexpl, isnanl, ldexpl, floorl, ceill, roundl, truncl etc.)?
> I have no access to an OpenBSD machine.

Here's the relevant contents of OpenBSD 4.0 <float.h>

#define LDBL_MANT_DIG   DBL_MANT_DIG
#define LDBL_EPSILON    DBL_EPSILON
#define LDBL_DIG        DBL_DIG
#define LDBL_MIN_EXP    DBL_MIN_EXP
#define LDBL_MIN        DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP    DBL_MAX_EXP
#define LDBL_MAX        DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP

Which is pretty pointless, since the default compiler uses 80-bit long
doubles:

$ uname -a
OpenBSD host 4.0 GENERIC#1107 i386
$ which cc
/usr/bin/cc
$ cc --version | head -n1
cc (GCC) 3.3.5 (propolice)

With this quick patch (no ChangeLog, yet), all 12 tests pass for:

./gnulib-tool --with-tests --test frexpl ceill roundl truncl isnanl ldexpl
floorl

where without it, 8 of the 12 tests fail.

diff --git a/lib/float.in.h b/lib/float.in.h
index 986719b..2504032 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -24,7 +24,7 @@
 #define _GL_FLOAT_H

 /* 'long double' properties.  */
-#if defined __i386__ && defined __BEOS__
+#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
 /* Number of mantissa units, in base FLT_RADIX.  */
 # undef LDBL_MANT_DIG
 # define LDBL_MANT_DIG   64
diff --git a/m4/float_h.m4 b/m4/float_h.m4
index 1b1ad10..d36e3a4 100644
--- a/m4/float_h.m4
+++ b/m4/float_h.m4
@@ -1,4 +1,4 @@
-# float_h.m4 serial 2
+# float_h.m4 serial 3
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H],
   AC_REQUIRE([AC_CANONICAL_HOST])
   FLOAT_H=
   case "$host_os" in
-    beos*)
+    beos* | openbsd*)
       FLOAT_H=float.h
       gl_CHECK_NEXT_HEADERS([float.h])
       ;;

But I'm hesitant to check it in without a review.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]