Bulletin number: 358 Products affected: D7214A Description: #define of double constants gives bad accuracy Component: icc Date: Wed Jan 30 16:06:28 GMT 1991 ----- There is a bug (actually a number of bugs) in the compiler's floating-point constant expression evaluation routines for floating-point difference and floating-point division. Basically Codemist assume that a right-shift on a signed integer is an arithmetic shift which is true on every host which we support except for the transputer. This will not occur on the Sun and VAX hosted versions of the compiler. The bug will be fixed in the next release. A workaround can be achieved by replacing #define M_PI ((double) 3.141592653) with static const double M_PI = 3.141592653; Code below illustrates the problem. #include #include #define M_PI ((double) 3.141592653) #define SIDEB ((double) 9.232500397) int main() { double delta; double side = SIDEB; printf("1\n"); printf("side = %5.15f\n",side); delta = M_PI / side; printf("delta = %5.15f\n",delta); printf("2\n"); printf("SIDEB = %5.15f\n",SIDEB); delta = M_PI / SIDEB; printf("delta = %5.15f\n",delta); } produces the following results: ------------------------------- Booting root transputer...ok 1 side = 9.232500397000001 delta = 0.340275387805109 <-- this is correct 2 SIDEB = 9.232500397000001 delta = 0.340290340613533 <-- this is wrong