Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rsqrt method to Float trait #343

Closed
davll opened this issue Nov 9, 2017 · 4 comments
Closed

Add rsqrt method to Float trait #343

davll opened this issue Nov 9, 2017 · 4 comments

Comments

@davll
Copy link

davll commented Nov 9, 2017

rsqrt is a widely used math function in game development, and is faster than combining the two functions: recip(sqrt(x)) thanks to x86 SSE instructions RSQRTSS, RSQRTPS, RSQRTSD, and RSQRTPD. Should we consider add rsqrt to Float trait?

  • x86/x86_64 SSE: _mm_rsqrt_ps (note that RSQRT instruction is approximate, less accurate than SQRT)
  • ARM Neon VRSQRTE
  • PowerPC Altivec: vec_rsqrte
@cuviper
Copy link
Member

cuviper commented Nov 10, 2017

This should probably be proposed for the standard library first. So far we don't have any arch-specific code -- I'd rather just have num's impl Float for f64 forward to an optimized/intrinsic call in std.

@clarfonthey
Copy link

I agree; it makes sense to offer this in libstd.

@davll
Copy link
Author

davll commented Nov 10, 2017

Reasonable, I'll propose it in rust-lang/rust.
I'll keep the issue open as reminder.

@cuviper
Copy link
Member

cuviper commented Dec 19, 2017

This issue was moved to rust-num/num-traits#1

@cuviper cuviper closed this as completed Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants