Thread View: comp.sys.sequent
1 messages
1 total messages
Started by Clay Luther
Wed, 29 May 1991 20:05
Arrgh, Floating Point exception on sequent! Help!
Author: Clay Luther
Date: Wed, 29 May 1991 20:05
Date: Wed, 29 May 1991 20:05
39 lines
1550 bytes
1550 bytes
I cannot figure this one out. My program is generating a floating point
exception when testing two valid float numbers. Here is the code...
40 int r1, r2;
41 float fval;
42 float tval;
43
44 r1 = (int)x;
45 tval = (x - r1);
46 fval = float_rand();
47 r2 = r1+1;
48 if ( fval > tval ) {
49 return r1;
50 } else {
51 return r2;
52 }
x is register float, and is passed into the function. Originally, I had the
function written simply as:
return ( ( float_rand() > x-(int)x ) ? (int)x : (int)(x+1) );
but that generated a fp error. I expanded it so I could look at each step.
The error occurs on line 48
if ( fval > tval ) {
WHY?
Dbx informs that both fval and tval have reasonable values. But this test just
doesn't work.
Confused.
--
Clay Luther Lonely C++ Programmer
cluther@ponder.csci.unt.edu
cluther@solo.csci.unt.edu I work here now and they still
cluther@supernet.haus.com don't let me have any opinions.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads