|
|
|
|
|
by seg_fault
606 days ago
|
|
Actually you can specify the numeric limits of the mantissa and the exponent.
They can be specified as template arguments[0].
So you could do: Float<uint8_t, // type of the mantissa
uint8_t, // type of the exponent
0, // lowest possible value of the mantissa
4095, // highest possible value of the mantissa
0, // lowest possible value of the exponent
7> // highest possible value of the exponent
The Float then simulates an unsigned 12bit mantissa and a 3bit exponent. Sure it still takes 16 bytes. But you could create a union with bitfields where you shrink that even further.[0] https://github.com/clemensmanert/fas/blob/58f9effbe6c13ab334... |
|