You need to figure out where the actual evaluation happens. C preprocessor does not do floats, so if the expression is evaluated by the preprocessor, the result will be integer. But with casts all over the place, the compiler will do evaluation. But if all things going in are integers, then the result is going to be integer as well. You need to explicitly cast things to floats.
As far as I knew the C processor does't do math at all, but trusting Ataradov's track record....
$ cat pptest.c
#include <stdio.h>
#define A (2)
#define B (1+1)
int main(int argc, char *argv[]) {
#if A == B
printf("Equal\n");
#else
printf("Not equal\n");
#endif
}
$ gcc -o pptest pptest.c
$ ./pptest
Equal
$
Oh, that IS interesting! So "(2) == (1+1)" and I checked that "(2) == (1+1+1)" is false.
Suddenly a rabbit hole appears...
#include <stdio.h>
#define A (Y)
#define B (N)
int main(int argc, char *argv[]) {
#if A == B
printf("Equal\n");
#else
printf("Not equal\n");
#endif
}
$gcc -o pptest pptest.c
$ ./pptest
Equal
WFT - how can "(Y) == (N)"
? - Let me guess, as 'Y' is undefined it is 0, and so is 'N'.
Must look away before I start reading the C standards...