delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/06/21/00:06:41

Message-ID: <000e01c337aa$7b238800$0100a8c0@acp42g>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: <djgpp-workers AT delorie DOT com>
References: <200306201334 DOT h5KDYMWU012441 AT speedy DOT ludd DOT luth DOT se>
Subject: LIBM patch for GCC 3.3 - math changes
Date: Sat, 21 Jun 2003 14:06:23 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Reply-To: djgpp-workers AT delorie DOT com

Thanks for the feedback. So here goes the first of a second attemp

> The basic idea is a step in the right direction. However I suggest you
> make the union public with a sensible name in ieee.h. This will
> (hopefully) make us use one type defined once and not a pletora of
> different ones.

Below is a patch for ieee.h

> If you choose not to do the renaming of double_t below, it would be a
> great help if it's defined in one place for the time when we _will_
> rename double_t.
>
> Then there's the matter that float_t and double_t must be renamed as
> they clashes with C99.
..SNIP..
> It makes sense to clean out this C99 incompatibility if you're going
> to mess with the use of double_t anyway.

It does make sense if I had enough time to, but I don't so I would like to
keep the two sets of patches seperate otherwise it will take longer to get
merged in.

Just in the src\libc\math directory I had to modify 26 files and the total
diff came to 29K of text so instead of including it all here I have put an
example of one of the files below and have included the changes for the math
only changes in a zip called  LIBC_MATH_DIF.ZIP (included ieee.dif) which is
available from http://clio.rice.edu/djgpp/win2k/LIBC_MATH_DIF.ZIP

Let me know what people think about this. I will now start on a patch for
the other source files that I modified for GCC 3.3.


*** \djgppcvs\include\libc\ieee.h       Wed Feb  5 18:10:52 2003
--- ieee.h      Sat Jun 21 12:37:40 2003
*************** typedef struct {
*** 38,43 ****
--- 38,56 ----
    unsigned sign:1;
  } long_double_t;

+
+ typedef union
+ {
+   double d;
+   double_t dt;
+ } _double_union_t;
+
+ typedef union
+ {
+   float f;
+   long  l;
+ } _float_long_union;
+
  #endif /* !_POSIX_SOURCE */
  #endif /* !__STRICT_ANSI__ */
  #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */




*** old\ef_scalb.c Tue Apr 15 19:39:46 1997
--- ef_scalb.c Sat Jun 21 13:35:16 2003
***************
*** 15,20 ****
--- 15,21 ----

  #include "fdlibm.h"
  #include <limits.h>
+ #include <libc/ieee.h>

  #ifdef _SCALB_INT
  #ifdef __STDC__
***************
*** 35,42 ****
  #ifdef _SCALB_INT
   return scalbnf(x,fn);
  #else
!  if (isnanf(x)||isnanf(fn)) return x*fn;
!  if (!finitef(fn)) {
       if(fn>(float)0.0) return x*fn;
       else       return x/(-fn);
   }
--- 36,49 ----
  #ifdef _SCALB_INT
   return scalbnf(x,fn);
  #else
!  _float_long_union ux;
!  _float_long_union ufn;
!
!  ux.f = x;
!  ufn.f = fn;
!
!  if (isnanf(ux.l)||isnanf(ufn.l)) return x*fn;
!  if (!finitef(ufn.f)) {
       if(fn>(float)0.0) return x*fn;
       else       return x/(-fn);
   }


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019