What\'s wrong with the following code?
#define DELAY_CYCLES ((int)(0.1/0.001)) typedef struct { double state_history[N_X][DELAY_CYCLES]; double foo; } foo
Even if it were an integer constant expression, (int)(0.1/0.001)
could easily be either 99 or 100, since the values 0.1
and 0.001
do not exist in floating point. Determining which value IEEE 754 specifies would require checking both of 0.1 and 0.001 to see whether they're closer to their neighbors above or below, then actually doing the division of those neighbors - or just checking it on a conformant system. However this is one place where I would not want to rely on the implementation being conformant to get the right answer.