Question.2
A developer creates a fixed-point type for MCUs without FPU:
class Fixed8 {
int16_t raw; // value * 256
public:
Fixed8(float v) : raw(v * 256) {}
Fixed8 operator+(const Fixed8& o) const {
Fixed8 r(0); r.raw = raw + o.raw; return r;
}
float to_float() const { return raw / 256.0f; }
};
Fixed8 a(1.5f), b(2.25f);
Fixed8 c = a + b;
printf("%.2f", c.to_float());What is the output?