Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2002 06:19:33 -0700 (PDT)
From:      David Schultz <dschultz@uclink.Berkeley.EDU>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/38288: [PATCH] float.h: long doubles use extended precision
Message-ID:  <200205191319.g4JDJXa22132@HAL9000.wox.org>

next in thread | raw e-mail | index | archive | help

>Number:         38288
>Category:       i386
>Synopsis:       [PATCH] float.h: long doubles use extended precision
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 19 06:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     David Schultz
>Release:        FreeBSD 4.5-RELEASE-p2 i386
>Organization:
>Environment:
System: 

>Description:
float.h defines incorrect constants for long doubles, which are 80
bits long and have 64 bits of precision on i386.  The following patch
corrects the constants and defines the additional constants
FLT_EVAL_METHOD and DECIMAL_DIG required by C99.

This patch is likely to apply to other architectures.  In particular,
I believe it applies to ia64, but NOT sparc64.  But i386 is the only
one I'm sure about.

>How-To-Repeat:

>Fix:

Index: float.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/float.h,v
retrieving revision 1.8
diff -u -r1.8 float.h
--- float.h	1999/08/28 00:44:11	1.8
+++ float.h	2002/05/19 13:04:30
@@ -39,6 +39,8 @@
 
 #define FLT_RADIX	2		/* b */
 #define FLT_ROUNDS	1		/* FP addition rounds to nearest */
+#define FLT_EVAL_METHOD	2		/* must agree with float_t in math.h */
+#define DECIMAL_DIG	21
 
 #define FLT_MANT_DIG	24		/* p */
 #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */
@@ -60,13 +62,14 @@
 #define DBL_MAX		1.7976931348623157E+308
 #define DBL_MAX_10_EXP	308
 
-#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
+#define LDBL_MANT_DIG	64
+#define LDBL_EPSILON	1.08420217248550443400E-19L
+#define LDBL_DIG	19
+#define LDBL_MIN_EXP	(-16381)
+#define LDBL_MIN	3.36210314311209350626E-4932L
+#define LDBL_MIN_10_EXP	(-4931)
+#define LDBL_MAX_EXP	16384
+#define LDBL_MAX	1.18973149535723176502E+4932L
+#define LDBL_MAX_10_EXP	4932
+
 #endif /* _MACHINE_FLOAT_H_ */
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205191319.g4JDJXa22132>