rust-lang / portable-simd

The testing ground for the future of portable SIMD in Rust
Apache License 2.0
875 stars 79 forks source link

feat: add SIMD float math functions (exp, exp2, log, log2, log10, sin… #400

Closed avhz closed 7 months ago

avhz commented 7 months ago

Hi,

In relation to #14, I've added some math functions to check with you if I'm on the right track.

I simply followed the implementation that was already there for sqrt, and for functions that I easily found were already in intrinsics.

Let me know if it's the right way to go :)

Cheers!

Edit: I manually checked the output values against R, and they were all correct.

calebzulawski commented 7 months ago

Thank you! I'm now noticing how lacking our tests are in this area, but we can leave that for another day.

avhz commented 7 months ago

My pleasure :)

I did notice that too, and I didn't check any special values like T:MAX, infinity, etc. But I can add tests for these.

In #14 you mentioned adding intrinsics to the compiler, is this completely done ?

calebzulawski commented 7 months ago

I actually thought the intrinsics you used here didn't exist yet. There might be some still missing, but none stand out to me right now. Also, I opened #401 to add the tests.

calebzulawski commented 7 months ago

After a quick check, the intrinsics that seem to be missing are the pow/powi intrinsics