Mail Archives: djgpp-workers/2003/06/21/00:06:41
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 -