katyo / uctl-rs

Generic control library for low-end hardware
2 stars 0 forks source link

Q31 ratio paniced #4

Open andrey-shigantsov opened 4 years ago

andrey-shigantsov commented 4 years ago

Hello! Thanks for this cool crate!

When I try use bin::Fix<P31, N31> ratio paniced at 'attempt to multiply with overflow'.

How can i get around this? (I need i32 for cmsis dsp lib)

katyo commented 4 years ago

I would like looking code sample which crashes

andrey-shigantsov commented 4 years ago

Fix<P31, N31>::from(0.25)

andrey-shigantsov commented 4 years ago

Overflow occurs for let ratio = 2_i31.pow(31). (ratio = i32::MAX + 1)