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

Req. update(_:) method #113

Open
oscbyspro opened this issue Nov 22, 2023 · 2 comments
Open

Req. update(_:) method #113

oscbyspro opened this issue Nov 22, 2023 · 2 comments
Labels
addition oh, so shiny! maybe to do, or not to do?

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Nov 22, 2023

I'm working on some prime stuff, and I need a squareRoot(of:) method that doesn't rely on floating points. So, I use Newton's method. It's relatively fast and super simple. In doing so, I noticed that the implementation for core integers and what I might write for UIntXL is similar. UIntXL has an update(_:) method for in-place assignments. If all binary integers had this method, then perhaps I could make squareRoot(of:) and friends generic over all binary integer.

@oscbyspro oscbyspro added addition oh, so shiny! maybe to do, or not to do? labels Nov 22, 2023
@oscbyspro
Copy link
Owner Author

oscbyspro commented Nov 22, 2023

As a side note, I can get a decent initial approximation as I've already added leadingZeroBitCount to NBKBinaryInteger.

@oscbyspro
Copy link
Owner Author

oscbyspro commented Nov 22, 2023

Although, in this particular case it might not matter because the assignment is followed by division 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition oh, so shiny! maybe to do, or not to do?
Projects
None yet
Development

No branches or pull requests

1 participant