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

Make Rust version no_std and improve docs #120

Merged
merged 10 commits into from Oct 15, 2023
Merged

Make Rust version no_std and improve docs #120

merged 10 commits into from Oct 15, 2023

Conversation

Keavon
Copy link
Contributor

@Keavon Keavon commented Oct 7, 2023

No description provided.

@Keavon Keavon marked this pull request as draft October 7, 2023 03:43
Rust/src/lib.rs Outdated
Comment on lines 513 to 533
#[cfg(feature = "no_std")]
// Result is often identical, or otherwise extremely close to, std::f32::sqrt.
// In testing, the worst error seems to be around the order of magnitude of 0.00001% off.
let result = {
if f == 0. {
return 0.;
}

// Explanation: https://stackoverflow.com/questions/41785416/how-does-this-sqrt-approximation-inline-assembly-function-work
let mut guess = f32::from_bits((f.to_bits() + 0x3f80_0000) >> 1);

loop {
let new_guess = 0.5 * (guess + f / guess);
if new_guess == guess {
break;
}
guess = new_guess;
}

guess
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could port this for the accurate implementation?

@Auburn
Copy link
Owner

Auburn commented Oct 14, 2023

Could you pr these changes into the v1.1 branch, I'm getting ready to merge that to master

@Keavon Keavon marked this pull request as ready for review October 14, 2023 20:50
@Keavon Keavon changed the base branch from master to v1.1 October 14, 2023 20:58
@Keavon
Copy link
Contributor Author

Keavon commented Oct 14, 2023

I updated the branch and version numbering. However upon changing the base to merge this into, it looks like it created conflicts. I'll have to wait a few hours or possibly until tomorrow until I can resolve those.

@Auburn Auburn merged commit 467e6c0 into Auburn:v1.1 Oct 15, 2023
@Keavon Keavon deleted the v1.0.2 branch October 15, 2023 22:07
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

Successfully merging this pull request may close these issues.

None yet

3 participants