home *** CD-ROM | disk | FTP | other *** search
- /*=============+==============================================================
-
- From: Derek Wills / Duncan MacLean
- Company: British Aerospace / Lightworks
- Tel: +44 482 667121 x5156 / +44 71 494 3084
- Fax:
- Compiler: 2.18
- Subject: floating point problems when -f used
- Date: 20/5/91
- Contact: Harjinder
- Status: Fixed in 3.0
-
- -------------+------------------------------------------------------------
-
- Comments: Program below compiled with: -O -3 -J -f gives incorrect
- results. However, if -f NOT used, correct results given.
-
- ============================================================================*/
-
- #include <stdio.h>
-
- void destroy(double a, double b, double c, double d)
- {
- printf("%lg %lg %lg %lg\n", a, b, c, d) ;
- }
-
- double q = 5.0 ;
- double p[500] ;
-
- void try_it(int i)
- {
- destroy(p[i+0], p[i+1], p[i+2], q+1) ;
- destroy(p[i+2], p[i+1], p[i+0], q+1) ;
- }
-
- void main()
- {
- for (int i=0; i<100; i++)
- p[i] = i ;
-
- try_it(1) ;
- }
-