home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / programm / 4441 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.4 KB  |  50 lines

  1. Path: sparky!uunet!mcsun!uknet!bcc.ac.uk!ps.ucl.ac.uk!pbooth
  2. From: pbooth@ps.ucl.ac.uk (Peter Booth)
  3. Newsgroups: comp.unix.programmer
  4. Subject: dbx and double functions
  5. Summary: dbx cannot examine value of double math functions
  6. Keywords: dbx math.h double functions
  7. Message-ID: <1992Aug25.175304.3957@bas-a.bcc.ac.uk>
  8. Date: 25 Aug 92 17:53:04 GMT
  9. Sender: news@ucl.ac.uk (Usenet News System)
  10. Distribution: comp
  11. Organization: Photogrammetry and Surveying, UCL
  12. Lines: 36
  13.  
  14. Has anyone come across this problem before? I am unable to print the
  15. value of functions declared as double in math.h whilst using dbx or 
  16. dbxtools on a SUN system. Code fragment :
  17. #include <stdio.h>
  18. #include <math.h>
  19.  
  20. extern double pow();
  21.  
  22. main()
  23.  
  24. {
  25.         double a, b;
  26.  
  27.                 {
  28.                 a = cos( (3.1415/2));
  29.                 b = pow( 10.0,3.0);
  30.                 printf("cosine(pi/2) is %8.3f and ten cubed is %8.3fkm", a,b);
  31.                 }
  32.         return 0;
  33. }
  34.  
  35. Dbxtool text window:
  36. dbxtool) print pow(10,3)
  37. pow(10, 3) = 0
  38. (dbxtool) print pow(10.0,3.0)
  39. pow(10, 3) = 1083129856
  40. (dbxtool) whatis pow()
  41. $integer;
  42. (dbxtool) whatis cos()
  43. $integer
  44. dbxtool) print (double) cos(3.14)
  45. (double ) (int ) cos(3.14000000000000012) = 1074339512.0
  46.  
  47. dbx seems to think these are int functions (apologies for anthropomorphism)
  48. This is a simplification of a mathematically complex function I am
  49. trying to debug step by step. I've RTFMd and I've RTFFAQd. Any ideas?
  50.