Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: don't try to compare IEEE NaN's
@ 2001-06-05 20:40 Jim Blandy
  2001-06-05 23:14 ` Eli Zaretskii
  2001-06-06  6:45 ` Fernando Nasser
  0 siblings, 2 replies; 24+ messages in thread
From: Jim Blandy @ 2001-06-05 20:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Snyder

2001-06-05  Jim Blandy  <jimb@redhat.com>

	* gdb.base/return2.exp (main): Use values to test float and double
	returns that are not NaN's, to avoid being confused by IEEE
	comparison rules.

Index: gdb/testsuite/gdb.base/return2.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/return2.c,v
retrieving revision 1.2
diff -c -r1.2 return2.c
*** gdb/testsuite/gdb.base/return2.c	2000/12/20 14:34:27	1.2
--- gdb/testsuite/gdb.base/return2.c	2001/06/06 03:39:25
***************
*** 84,91 ****
    int_resultval       = int_func ();		/* short_checkpoint */
    long_resultval      = long_func ();		/* int_checkpoint */
    long_long_resultval = long_long_func ();	/* long_checkpoint */
!   float_resultval     = float_func ();		/* long_long_checkpoint */
!   double_resultval    = double_func ();		/* float_checkpoint */
    main_test = 1;				/* double_checkpoint */
    return 0;
  }
--- 84,110 ----
    int_resultval       = int_func ();		/* short_checkpoint */
    long_resultval      = long_func ();		/* int_checkpoint */
    long_long_resultval = long_long_func ();	/* long_checkpoint */
! 
!   /* On machines using IEEE floating point, the test pattern of all
!      1-bits established above turns out to be a floating-point NaN
!      ("Not a Number").  According to the IEEE rules, NaN's aren't even
!      equal to themselves.  This can lead to stupid conversations with
!      GDB like:
! 
!        (gdb) p testval.float_testval == testval.float_testval
!        $7 = 0
!        (gdb)
! 
!      This is the correct answer, but it's not the sort of thing
!      return2.exp wants to see.  So to make things work the way they
!      ought, we'll set aside the `union' cleverness and initialize the
!      test values explicitly here.  These values have interesting bits
!      throughout the value, so we'll still detect truncated values.  */
! 
!   testval.float_testval = 2.7182818284590452354;/* long_long_checkpoint */
!   float_resultval     = float_func ();		
!   testval.double_testval = 3.14159265358979323846; /* float_checkpoint */
!   double_resultval    = double_func ();		
    main_test = 1;				/* double_checkpoint */
    return 0;
  }


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2001-06-07 11:38 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-05 20:40 RFA: don't try to compare IEEE NaN's Jim Blandy
2001-06-05 23:14 ` Eli Zaretskii
2001-06-06  6:54   ` Fernando Nasser
2001-06-06  7:27   ` Jim Blandy
2001-06-06  8:46     ` Eli Zaretskii
2001-06-06  9:15       ` Fernando Nasser
2001-06-06 11:38         ` Jim Blandy
2001-06-06 11:52           ` Fernando Nasser
2001-06-06 13:59             ` Michael Snyder
2001-06-06 23:20             ` Eli Zaretskii
2001-06-06 23:19           ` Eli Zaretskii
2001-06-06 10:37       ` Jim Blandy
2001-06-06 10:55         ` Michael Snyder
2001-06-06 11:04           ` Fernando Nasser
2001-06-06 11:15             ` Michael Snyder
2001-06-06 15:08           ` Jim Blandy
2001-06-06 23:19           ` Eli Zaretskii
2001-06-06 23:19         ` Eli Zaretskii
2001-06-07 10:38           ` Michael Snyder
2001-06-07 11:38             ` Eli Zaretskii
2001-06-06 13:17   ` Michael Meissner
2001-06-06 13:45     ` Fernando Nasser
2001-06-06 23:21     ` Eli Zaretskii
2001-06-06  6:45 ` Fernando Nasser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox