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

"Babylonian Square Roots" Javascript test case 0 is incorrect #69

Open
tiitlan opened this issue Apr 17, 2021 · 1 comment
Open

"Babylonian Square Roots" Javascript test case 0 is incorrect #69

tiitlan opened this issue Apr 17, 2021 · 1 comment

Comments

@tiitlan
Copy link

tiitlan commented Apr 17, 2021

"Babylonian Square Roots" Javascript test case 0 is incorrect - it is expecting that the answer will be exactly zero, which is not the case if 10 decimal places of precision is required.

@ali-ramadhan
Copy link
Member

Ah you're correct, thank you for pointing this out.

Looks like it's expecting a relative tolerance of 1e-10:

RTOL = {
'sqrt_n': 1e-10
}

which makes sense but won't work if the answer is zero like you say.

I think we need to modify the values_match function to properly handle the case of comparing with zero:

def values_match(v1, v2, tt, tol) -> bool:

Also wouldn't hurt to mention this more explicitly in the problem description!

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