Floating point problems

Rebecca Marvil marvil at tigger.colorado.edu
Fri Aug 11 04:55:49 AEST 1989


I've been having floating point problems on an Iris 2400 turbo 
running version GL2-W3.5, and was wondering if anyone can help.

The problem is that floating point operations do not work
properly.  I first noticed this when I tried to print a 
float variable as follows: 

	float x = 0.5;
	printf("x = %f",x);

When execution reaches the printf statement, it hangs on the
%f.  Using dbx, I ran the program, then typed CTRL-C after execution
stopped at the %f, and found that the program was hung in the
subroutine '_sw_f_div()'.

I've also found that float variables cannot be added or subtracted
accurately (it seems to be a problem with the sign).  Also, 
opposite signed floats are thought to be equal (ie.  0.01 is equal
to -0.01).  

Conversions also don't work properly.  For instance, if
I cast a float variable to an int, the result is the correct integer
value, but the sign is always negative, whether or not the original
float was negative.  Also, if I use atof(), I don't get the correct float
result.

If anyone has a clue as to what my problem is, I would appreciate
a response.  One possibility, I suppose, is that the fpa board
is screwed up.  If so, is there a way to bypass this board and
have the software do floating point operations?

Thanks in advance for any suggestions,

Becky Marvil			
Dept of MCD Biology		email:  marvil at boulder.colorado.edu
University of Colorado
Boulder, CO 80309
(303)-492-3600



More information about the Comp.sys.sgi mailing list