The bug
If a player rotates left far enough the rotation value will go into negatives resetting to 0 after reaching -360. The rotation value should only range from -180 to 180 instead of -360 to 360.
You can recreate this by entering this command:
/data get entity @p Rotation[0] 1
Rotate to different directions and look at what the output is. If you spin far to the right you will get a positive output, if you spin far to the left, you will get a negative output.
Related issues
Attachments
Comments


The value isn't wrapped; when you rotate 360 degrees then the value changes by 360 so if you go -360, then it may become negative (and if you do another -360, it'll become even more negative). In a few cases the game undoes this wrapping; see MC-120545.
I'm not sure whether this actual issue should be considered WAI/duplicate though. The lack of wrapping is weird behavior.

For better testing, use these commands:
/scoreboard objectives add Rot dummy
/scoreboard objectives setdisplay sidebar Rot
And in a repeating command block,
execute store result score @p Rot run data get entity @p Rotation[0] 1
I would say this issue relates to MC-120545. It isn't necessarily a duplicate as this ticket purely involves the player rotating around manually rather than using the teleport command. I believe that the actual rotation of the player remains unbound, and only the display of the player's rotation using the command above will apply (incorrectly) wrapping to the rotation. It is this unbound rotation that causes the issues in MC-120545, and it is an improper wrapping function that causes the issue in this ticket.

Confirmed for 1.13.1.
Thank you for your report!
However, this issue is being tracked in MC-121855.
If you have any additional information you'd like to add, feel free to comment there. Don't forget to vote and watch for updates on the issue!
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Mojang Support – ✍️ Feedback and Suggestions – 📖 Game Wiki