home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / bsd / 10913 < prev    next >
Encoding:
Text File  |  1993-01-05  |  2.0 KB  |  53 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!UB.com!quack!dfox
  3. From: dfox@quack.sac.ca.us (David Fox)
  4. Subject: Re: Bug in mathlib (i.e. -lfpu)
  5. Message-ID: <fXxRySh@quack.sac.ca.us>
  6. Organization: The Duck Pond public unix: +1 408 249 9630, log in as 'guest'.
  7. References: <1993Jan4.213529.23355@cm.cf.ac.uk>
  8. Date: 5 Jan 1993 05:15:05 UTC
  9. Lines: 42
  10.  
  11. In article <1993Jan4.213529.23355@cm.cf.ac.uk> paul@isl.cf.ac.uk (Paul Richards) writes:
  12. >I was getting totally different results from a program when compiled
  13. >with the mathlib routines so I thought I'd track down the problem.
  14. >
  15. >Anyway, pow seems to mess up the results of expressions when the
  16. >numerator of the expression is a function and pow is the denominator.
  17. >I'll try and track down the cause tomorrow (It's getting late here).
  18. >
  19. >Below is a test program which shows the problem. Compile it with the
  20. >stock -lm and with -lfpu and note the difference.
  21.  
  22. I think you might have problems with the posted code since it uses
  23. float arithmetic, and you are using -lfpu which is for type double
  24. only.  You should use the -lcfpu library, as that is the combined
  25. float/double math library.
  26.  
  27. I didn't experience a problem - I got 0.50000 as the answer whether
  28. I used the combined mathlib or the double-only mathlib.  However, the
  29. code only runs through two times instead of five (as the for() loop
  30. suggests) - could the bug screw up the loop variable?
  31.  
  32. [ a few seconds later]
  33.  
  34. It does on my system.  I just went to another virtual console and
  35. compiled for libm.a - it runs five iterations.
  36.  
  37. Also, this could explain the problems with ghostscript. Earlier today,
  38. I tried recompiling it using -lcfpu and got a floating point exception.
  39. It works fine with libm.a.
  40.  
  41. Interestingly, ephem works nicely with -lfpu.  It must not use the
  42. pow() function, but it does use trig functions rather heavily.  (Using
  43. mathlib does greatly speed this program, BTW.)
  44.  
  45. If you find the bug, please post it, and I'll recompile ghostscript with
  46. the fixed libmath.
  47.  
  48. --
  49. David Fox
  50. dfox@quack.sac.ca.us
  51.  
  52.  
  53.