-
Notifications
You must be signed in to change notification settings - Fork 7
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
Make types generic #35
Comments
Well, I'm not sure whether algorithms which are stable for 64-bit floats are necessarily stable for 32-bit floats. It seems like stepping down the precision shouldn't cause an issue, but floating point errors can sometimes be counter-intuitive. I guess we'd have to test it! Unfortunately, I've been quite busy in the last couple of weeks with a new job, and I know @Axect has had a lot on his plate for some time now. :( It sounds like a great feature to have, though. 32-bit arithmetic would allow this library to support hardware without 64-bit FPUs or software emulation. |
Cool, I'll see about implementing this and testing it out when I have time, too! Thanks! |
Hello @bojohnson5 , When I initially developed Puruspe, the primary focus was on implementing special functions with sufficient precision, which is why I chose to work exclusively with f64. However, I completely agree that extending support to f32 through generic implementation would be a valuable addition to the library, particularly for use cases involving hardware without 64-bit FPUs or where software emulation is needed. As @ethanbarry correctly pointed out, we need to be careful about numerical stability when working with different floating-point precisions. While implementing generics using num-traits is technically feasible, we would need to develop tailored test suites specifically for f32 to ensure the algorithms maintain their stability and accuracy at lower precision. This would be a significant and welcome contribution to Puruspe. If you're interested in working on this feature, I'd be happy to provide guidance and review the implementation. We should pay particular attention to:
Let me know if you'd like to proceed with this enhancement, and we can discuss the implementation details further. |
I’m wondering what it would look like to make the types generic for any floating point number rather than having f64 hardcoded. Would implementing generics using num-traits be viable? That’s a pull request I could work on if it makes sense.
The text was updated successfully, but these errors were encountered: