#include <stdio.h>
#define n 16
#define a -2.0
#define b 2.0
#define c (b-a)/n
int main() {
printf("%lf\n",5.0*c);
}
Outputs 1.250000
But if i change (b-a)/n to b/n-a/n it outputs 0.750000.
#include <stdio.h>
#define n 16
#define a -2.0
#define b 2.0
#define c b/n-a/n
int main() {
printf("%lf\t%lf\n",c,5.0*c/5.0);
}
Outputs 0.250000 0.650000
So if i print c alone it's correct, but if i actually perform some operation with it, it turns out that c is different.
Update: It seems to require the expression to be in parentheses. (b/n-a/n)
(b/n-a/n)itself is a weak suggestion and may attracts DVs.