-
Notifications
You must be signed in to change notification settings - Fork 2
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
Handling square roots #2
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A design decision must be made for how to calculate and handle square root values.
There's two ways to handle square roots:
Some
value only when it's an exact result (i.e. the numerator and denominator are perfect squares), orNone
otherwise.There's also the option of providing both through different method names. The first method can be called
checked_sqrt
and the second onesqrt
, wherechecked_sqrt
can be mentioned in the documentation forsqrt
in case that behavior is preferable to the user.Update:
sqrt()
has been implemented by converting to float, using{f32,f64}::sqrt()
, and then converting back to the corresponding rational value. The float conversion is derived from this post. Some tests should be written to ensure that it works.The text was updated successfully, but these errors were encountered: