Article View: gnu.gcc.bug
Article #2460patch for inline math library.
From: Matthew Self
Date: Fri, 24 Mar 1989 21:54
Date: Fri, 24 Mar 1989 21:54
137 lines
4031 bytes
4031 bytes
Here is a patch to correct the argument types of the modf() function
in the inline math library (thanks to Dirk Grunwald for catching
this). Also included is a program which appears to demonstrate a bug
in gas for the 68881 (thanks to Kriton Kyrimis). I don't know where
such bugs should be reported....
#include <math.h>
double
foo(x,y)
double x, y;
{
printf("%lf\n", atan2(x,y));
}
gas 1.31 reports the following error:
159:Ignoring junk after expression
Here is the relevant assembler:
L147:
fcmpd LC0,fp0
fjnlt L150 (this is line 159)
fmovex fp1,fp3
fdivx fp0,fp3
moveq #-72,d0
addl a6,d0
Sun's assembler has no problem with this.
I should also point out that there has been some confusion over what
this library is meant to do. It is an ANSI math library only. It
does not provide any support for -traditional features such as
declaring atof(), or BSD functions like gamma(). These would be great
additions (and the 68881 has instructions for many of them), but
providing ANSI compliance was my first priority.
--Matthew
*** math.h.dist Fri Mar 24 13:20:32 1989
--- math.h Fri Mar 24 13:22:28 1989
***************
*** 1,5 ****
/******************************************************************\
* *
! * ANSI <math.h> last modified: March 6, 1989. *
* *
* Copyright (C) 1989 by Matthew Self. *
--- 1,5 ----
/******************************************************************\
* *
! * ANSI <math.h> last modified: March 24, 1989. *
* *
* Copyright (C) 1989 by Matthew Self. *
***************
*** 48,52 ****
extern double
! frexp (double x, int *exp), modf (double x, int *ip);
#endif /* Different machine types */
--- 48,52 ----
extern double
! frexp (double x, int *exp), modf (double x, double *ip);
#endif /* Different machine types */
***************
*** 67,71 ****
extern double
! frexp (double x, int *exp), modf (double x, int *ip);
#endif /* __STRICT_ANSI */
--- 67,71 ----
extern double
! frexp (double x, int *exp), modf (double x, double *ip);
#endif /* __STRICT_ANSI */
***************
*** 84,88 ****
fmod (double x , double y),
ldexp (double x, int n),
! frexp (double x, int *exp), modf (double x, int *ip);
#endif /* __GNUC__ */
--- 84,88 ----
fmod (double x , double y),
ldexp (double x, int n),
! frexp (double x, int *exp), modf (double x, double *ip);
#endif /* __GNUC__ */
*** math-68881.h.dist Fri Mar 24 13:22:03 1989
--- math-68881.h Fri Mar 24 13:23:04 1989
***************
*** 1,5 ****
/******************************************************************\
* *
! * <math-68881.h> last modified: March 22, 1989. *
* *
* Copyright (C) 1989 by Matthew Self. *
--- 1,5 ----
/******************************************************************\
* *
! * <math-68881.h> last modified: March 24, 1989. *
* *
* Copyright (C) 1989 by Matthew Self. *
***************
*** 375,379 ****
}
! __inline static double modf (double x, int *ip)
{
double temp;
--- 375,379 ----
}
! __inline static double modf (double x, double *ip)
{
double temp;
***************
*** 382,386 ****
: "=f" (temp) /* integer-valued float */
: "f" (x));
! *ip = (int) temp;
return x - temp;
}
--- 382,386 ----
: "=f" (temp) /* integer-valued float */
: "f" (x));
! *ip = temp;
return x - temp;
}
Technical Details
Message-ID:
<8903242154.AA03742@bayes.arc.nasa.gov>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!BAYES.ARC.NASA.GOV!selfShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!BAYES.ARC.NASA.GOV!self From: self@BAYES.ARC.NASA.GOV (Matthew Self) Newsgroups: gnu.gcc.bug Subject: patch for inline math library. Message-ID: <8903242154.AA03742@bayes.arc.nasa.gov> Date: 24 Mar 89 21:54:43 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 137