home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!mips!swrinde!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!ceg.uiuc.edu!lee
- From: lee@ceg.uiuc.edu (Chris Lee)
- Newsgroups: comp.sys.hp
- Subject: comparisons in fortran:single or double?
- Keywords: strange results in comparisons
- Message-ID: <lee.714082981@ceg.uiuc.edu>
- Date: 17 Aug 92 20:23:01 GMT
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Lines: 37
-
-
- Could some compiler guru help me on this?
-
- We are running 8.07 on 700s, and I have been getting some strange
- behavior from the compiler.
-
- I have 2 variables A and B, and I compare A and B. The fortran line
- goes like
-
- if (a.ge.b) then
- do this thing
- else
- ...
-
- The values of A and B are both 4.4E-07, but the IF fails! So I assign
- the value of A to a double precision variable just for curiosity and get
- the following.
-
- A B
- real 4.40000E-07 4.40000E-07
- double prec 4.399999795623444E-07 [unprinted]
-
- Does the compiler actually do the comparisons in double precision or
- something like that? My conventional wisdom tells me that since both
- A and B are declared as real, the comparison should be done as reals, and
- the IF should evaluate as true but...
-
- The code is about 5000 lines, so I don't think HP RC wants to look at
- it in its entirety.
-
-
- Thanks in advance
- --
- Chris Lee
- University of Illinois Urbana
- lee@ceg.uiuc.edu
- (217)244-2903
-