[DiscordArchive] <@250706991515828224> what do you mean by multiplying by 2-n?
[DiscordArchive] <@250706991515828224> what do you mean by multiplying by 2-n?
Archived author: Skarn • Posted: 2018-06-04T08:30:24.161000+00:00
Original source
Looks weird to me, decimal part is not used
Archived author: Quantam • Posted: 2018-06-04T08:30:42.598000+00:00
Original source
There's only one part, really (unless they're doing something super abnormal)
Archived author: Quantam • Posted: 2018-06-04T08:30:51.969000+00:00
Original source
You're just shifting the binary decimal point
Archived author: schlumpf • Posted: 2018-06-04T08:31:19.689000+00:00
Original source
<@197724887387734016> if you look closely it is only off by one due to rounding
Archived author: Skarn • Posted: 2018-06-04T08:31:47.890000+00:00
Original source
```py
integral_part = (fixed_point_val >> self.dec_bits) & (1 << self.int_bits) - 1
sign = -1.0 if (fixed_point_val & (1 << (self.dec_bits + self.int_bits)) != 0) else 1.0
self.value = sign * float(integral_part) * 2**-self.dec_bits
```
Archived author: Skarn • Posted: 2018-06-04T08:31:55.279000+00:00
Original source
is that correct for reading?
Archived author: Deleted User • Posted: 2018-06-04T08:32:33.045000+00:00
Original source
I use my bitshift stuff and it seems to work good enough
Archived author: Quantam • Posted: 2018-06-04T08:32:36.049000+00:00
Original source
My suspicion is that there is no sign bit either (it's two's complement), but without values to check I have no proof of that
Archived author: Skarn • Posted: 2018-06-04T08:33:31.511000+00:00
Original source
32767
Archived author: Skarn • Posted: 2018-06-04T08:33:39.550000+00:00
Original source
is the default value for transparency