[DiscordArchive] Wiki page where?
[DiscordArchive] Wiki page where?
Archived author: schlumpf • Posted: 2018-06-04T07:08:50.209000+00:00
Original source
Where do you think the code and struct come from?!
Archived author: Quantam • Posted: 2018-06-04T07:09:53.273000+00:00
Original source
If you have code for multiplication or division of two fixed points, should be immediately obvious whether it's power of two or not (I'd have to think a bit to even figure how you'd write a divider if it's not power of two)
Archived author: Deamon • Posted: 2018-06-04T07:10:26.977000+00:00
Original source
```
float MathHelper::fp69ToFloat(uint16_t x) {
const float divider = float(1 << 9);
float int_part = (x >> 9);
float float_part = (x & (1<<10) - 1) / divider;
return int_part + float_part;
}
```