sjb741
Junior Member level 2
//XC8 2.31
volatile uint32_t gRawCount;
//Watch result
gRawCount = (0.5 + (45/18)); //gRawCount = 2
gRawCount = (0.5 + 2.5); //gRawCount = 3
So (45/18) must have evaluated to a tiny bit under 2.5.
I am surprised becasue 0.5 is precisely representable as a floating point value (unlike say 0.1)
volatile uint32_t gRawCount;
//Watch result
gRawCount = (0.5 + (45/18)); //gRawCount = 2
gRawCount = (0.5 + 2.5); //gRawCount = 3
So (45/18) must have evaluated to a tiny bit under 2.5.
I am surprised becasue 0.5 is precisely representable as a floating point value (unlike say 0.1)