home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!uknet!cf-cm!myrddin.isl.cf.ac.uk!paul
- From: paul@isl.cf.ac.uk (Paul Richards)
- Newsgroups: comp.unix.bsd
- Subject: Bug in mathlib (i.e. -lfpu)
- Message-ID: <1993Jan4.213529.23355@cm.cf.ac.uk>
- Date: 4 Jan 93 21:35:28 GMT
- Sender: news@cm.cf.ac.uk (Network News System)
- Organization: Intelligent Systems Lab, ELSYM, Universiity of Wales, College of
- Cardiff.
- Lines: 31
-
- I was getting totally different results from a program when compiled
- with the mathlib routines so I thought I'd track down the problem.
-
- Anyway, pow seems to mess up the results of expressions when the
- numerator of the expression is a function and pow is the denominator.
- I'll try and track down the cause tomorrow (It's getting late here).
-
- Below is a test program which shows the problem. Compile it with the
- stock -lm and with -lfpu and note the difference.
-
- Anyone who has used mathlib (Interviews people take note) needs to
- check that their code doesn't do this.
-
- ----------------
-
- #include <math.h>
-
- float myproc()
- {
- return 1.0;
- }
-
- void main(void)
- {
- int i;
-
- for (i=0; i <5; i++)
- printf("test %f\n",myproc()/(float)pow(2.0,1.0));
- }
-
- ----------------
-