home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progc / fixed300.arj / CPML0000.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-23  |  1.1 KB  |  43 lines

  1. /*=============+==============================================================
  2.  
  3.   From:        Derek Wills / Duncan MacLean
  4.   Company:     British Aerospace / Lightworks
  5.   Tel:         +44 482 667121 x5156 / +44 71 494 3084
  6.   Fax:         
  7.   Compiler:    2.18
  8.   Subject:     floating point problems when -f used
  9.   Date:        20/5/91
  10.   Contact:     Harjinder
  11.   Status:      Fixed in 3.0
  12.  
  13.   -------------+------------------------------------------------------------
  14.  
  15.   Comments:    Program below compiled with: -O -3 -J -f gives incorrect 
  16.                results. However, if -f NOT used, correct results given.
  17.  
  18. ============================================================================*/
  19.  
  20. #include <stdio.h>
  21.  
  22. void destroy(double a, double b, double c, double d)
  23. {
  24.    printf("%lg %lg %lg %lg\n", a, b, c, d) ;
  25. }
  26.  
  27. double q = 5.0 ;
  28. double p[500] ;
  29.  
  30. void try_it(int i)
  31. {
  32.    destroy(p[i+0], p[i+1], p[i+2], q+1) ;
  33.    destroy(p[i+2], p[i+1], p[i+0], q+1) ;
  34. }
  35.  
  36. void main()
  37. {
  38.    for (int i=0; i<100; i++)
  39.       p[i] = i ;
  40.  
  41.    try_it(1) ;
  42. }
  43.