placeInAppropriate0To360Scope is a lot more complicated than it needs to be. I simplified it greatly (which also improves its readability) and added a more formal definition to the documentation for clarification.
Aside from the fact that the expected logic is the same as the original function, I performed 100 billion fuzz tests with random angles in a 64-revolution range and my new function does not deviate from the original function except for minuscule differences (less than 10^-12) due to floating point error that arises because the new implementation performs fewer operations, as well as in scenarios with multiple correct outputs (e.g. the original function returns 0 when provided 180.0, 0.0, while mine returns 360).
This was also tested in my school's 2024 competition (well I just graduated from there but you get the point) and it worked perfectly there.
placeInAppropriate0To360Scope
is a lot more complicated than it needs to be. I simplified it greatly (which also improves its readability) and added a more formal definition to the documentation for clarification.Aside from the fact that the expected logic is the same as the original function, I performed 100 billion fuzz tests with random angles in a 64-revolution range and my new function does not deviate from the original function except for minuscule differences (less than 10^-12) due to floating point error that arises because the new implementation performs fewer operations, as well as in scenarios with multiple correct outputs (e.g. the original function returns
0
when provided180.0, 0.0
, while mine returns360
).This was also tested in my school's 2024 competition (well I just graduated from there but you get the point) and it worked perfectly there.