7 kyu
Reflect Point Over Line
130 of 187skidd
Loading description...
Mathematics
Geometry
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
Javascript Translation
Approved!
This comment has been hidden.
Thanks
@it
.10e8
instead of1e8
etc.Thanks! Fixed the tests to use @it decorator and fixed the titles. I also noticed that I was doing 800 assertions per batch, when I wanted it to be 800 in total.
Description says range is +/-1e9 but tests test for +/-1e8.
change 10e8 to 1e8
Changed + added LATEX ¬‿¬
Thanks for this - learnt a new formula today.
Split your random tests into a couple of batches. Let each batch have a different range of numbers. Start with very low ranges, and work towards the huge ranges.
Also, 3000 tests might be somewhat of an overkill. I suggest 4 batches of each 100 tests.
Thanks for the suggestion. I just made batches of 100 from 1 to 10^8. (8 batches)
I would make 1 describe block with 8 it blocks in random tests. This also splits up the test cases in the feedback pane.
Good idea. Just split it up.
tuple_approx_eq()
only checks the first coordinate:Thanks for pointing this out, it's now fixed.
Expected value is incorrect, e.g:
Wolfram Alpha agrees that the result of reflecting
(82, -53)
alongy = 7x + 0
is(-93.56, -27.92)
:https://www.wolframalpha.com/input?i=reflect+%2882%2C-53%29+across+y%3D7x
Thanks, I fixed the solution.
Initial code has the incorrect function name:
reflect_point_over_line
should bereflect
and what's the problem with the first one, exactly...? It's... too long?!?
Changed name to
reflect
Don't round float results.
https://docs.codewars.com/authoring/recipes/floating-point#do-not-use-rounding-or-stringification-to-work-around-problems-with-precision
Thanks, I'm now testing for approximate equality instead.