Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA5975 ; Sat, 02 Jan 93 10:07:59 EST Newsgroups: comp.unix.bsd Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!UB.com!quack!dfox From: dfox@quack.sac.ca.us (David Fox) Subject: Re: Bug in mathlib (i.e. -lfpu) Message-ID: <fXxRySh@quack.sac.ca.us> Organization: The Duck Pond public unix: +1 408 249 9630, log in as 'guest'. References: <1993Jan4.213529.23355@cm.cf.ac.uk> Date: 5 Jan 1993 05:15:05 UTC Lines: 42 In article <1993Jan4.213529.23355@cm.cf.ac.uk> paul@isl.cf.ac.uk (Paul Richards) writes: >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. I think you might have problems with the posted code since it uses float arithmetic, and you are using -lfpu which is for type double only. You should use the -lcfpu library, as that is the combined float/double math library. I didn't experience a problem - I got 0.50000 as the answer whether I used the combined mathlib or the double-only mathlib. However, the code only runs through two times instead of five (as the for() loop suggests) - could the bug screw up the loop variable? [ a few seconds later] It does on my system. I just went to another virtual console and compiled for libm.a - it runs five iterations. Also, this could explain the problems with ghostscript. Earlier today, I tried recompiling it using -lcfpu and got a floating point exception. It works fine with libm.a. Interestingly, ephem works nicely with -lfpu. It must not use the pow() function, but it does use trig functions rather heavily. (Using mathlib does greatly speed this program, BTW.) If you find the bug, please post it, and I'll recompile ghostscript with the fixed libmath. -- David Fox dfox@quack.sac.ca.us