korken89 / biquad-rs

A Rust library for digital second order IIR filtrers, also known as biquads
Apache License 2.0
49 stars 13 forks source link

Supporting f64 #1

Closed Michel-Haber closed 5 years ago

Michel-Haber commented 5 years ago

Hello,

I am currently using your crate (thanks by the way) in a project. But I am handling f64 everywhere, which has forced me to make manual changes to the crate. The other solution (casting to f32 and back to f64) is impossible in my case.

So is it possible to make the crate generic to the type of float being used?

Cheers :)

korken89 commented 5 years ago

Hi! This is absolutely possible! I can have a look at it, the crate needed to do it is num-traits if you want to have a go and make a PR

korken89 commented 5 years ago

Hi, I added the f64 support - could you give it a try? I could not use num-traits, as there is no support for sin and cos in core.

korken89 commented 5 years ago

This is available from commit 616201be6f1c19e788218c9ec90c0628c97512f5

Michel-Haber commented 5 years ago

Awesome, I will test this right away. And I'll let you know!

korken89 commented 5 years ago

Thanks! The implementation is quite meh right now (from a generic view) as num-traits does not have libm support yet. As soon as https://github.com/rust-num/num-traits/pull/99 lands I'll update again and make it generic.

Michel-Haber commented 5 years ago

So the code builds, tests and benches the same :) I do look forward to getting a completely generic implementation :) But this does just as well for the moment.

Cheers :)

korken89 commented 5 years ago

Awesome! I'll make a release as 0.3.0.

korken89 commented 5 years ago

Now released, thanks for making me aware of this issue!