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

Switch from library panic to return an Error or other invalid return #8

Closed
ok-john opened this issue Jan 5, 2023 · 2 comments
Closed

Comments

@ok-john
Copy link
Contributor

ok-john commented Jan 5, 2023

Currently jacobi_symbol panics when p is even - perhaps this should return and Error, maybe -1?

/// Returns the Jacobi symbol `(a/p)` given an odd `p`. Panics on even `p`.
pub(crate) fn jacobi_symbol<const L: usize>(a: i32, p_long: &Uint<L>) -> JacobiSymbol {

Idea being that any dependent libraries who import this function can handle errors/panics instead of the underlying library panicing.

@fjarri
Copy link
Member

fjarri commented Jan 5, 2023

jacobi_symbol() is not currently exported, so these panics are more of a debug asserts (maybe that's what they should be instead).

@fjarri
Copy link
Member

fjarri commented Dec 29, 2023

jacobi_symbol() takes an Odd-wrapped integer since #38, so this is no longer an issue.

@fjarri fjarri closed this as completed Dec 29, 2023
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

2 participants