home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!bcc.ac.uk!ps.ucl.ac.uk!pbooth
- From: pbooth@ps.ucl.ac.uk (Peter Booth)
- Newsgroups: comp.unix.programmer
- Subject: dbx and double functions
- Summary: dbx cannot examine value of double math functions
- Keywords: dbx math.h double functions
- Message-ID: <1992Aug25.175304.3957@bas-a.bcc.ac.uk>
- Date: 25 Aug 92 17:53:04 GMT
- Sender: news@ucl.ac.uk (Usenet News System)
- Distribution: comp
- Organization: Photogrammetry and Surveying, UCL
- Lines: 36
-
- Has anyone come across this problem before? I am unable to print the
- value of functions declared as double in math.h whilst using dbx or
- dbxtools on a SUN system. Code fragment :
- #include <stdio.h>
- #include <math.h>
-
- extern double pow();
-
- main()
-
- {
- double a, b;
-
- {
- a = cos( (3.1415/2));
- b = pow( 10.0,3.0);
- printf("cosine(pi/2) is %8.3f and ten cubed is %8.3fkm", a,b);
- }
- return 0;
- }
-
- Dbxtool text window:
- dbxtool) print pow(10,3)
- pow(10, 3) = 0
- (dbxtool) print pow(10.0,3.0)
- pow(10, 3) = 1083129856
- (dbxtool) whatis pow()
- $integer;
- (dbxtool) whatis cos()
- $integer
- dbxtool) print (double) cos(3.14)
- (double ) (int ) cos(3.14000000000000012) = 1074339512.0
-
- dbx seems to think these are int functions (apologies for anthropomorphism)
- This is a simplification of a mathematically complex function I am
- trying to debug step by step. I've RTFMd and I've RTFFAQd. Any ideas?
-