Exercise 1: What Happens When Degrees Are Fed to a Function Expecting Radians — Possible Solution ==================================================================== COMPUTING THE ACTUAL DISPLAYED ANGLE ------------------------------ The renderer treats the raw value 45 as if it were 45 RADIANS, not 45 degrees. Converting 45 radians into degrees (to see what angle this actually corresponds to): 45 radians * (180/pi) = 2578.3100780887044 degrees Since rotation angles wrap every 360 degrees, the visually displayed angle is this value reduced modulo 360: 2578.3100780887044 mod 360 = 58.31007808870436 degrees So instead of displaying a clean 45-degree rotation, the renderer actually displays approximately 58.31 degrees. WHY THE BUG ISN'T OBVIOUS FROM THE NUMBER ITSELF ------------------------------ The number 45 looks completely reasonable as an angle - it's a common, "round" rotation value, well within the range a human would expect for a degree measurement, and it doesn't produce an error, crash, or obviously out-of-range result (a mistakenly huge or negative number would be much easier to notice at a glance). The resulting displayed angle, about 58.31 degrees, is also a plausible- looking angle on its own - there's nothing about either number in isolation that signals something went wrong. The bug is only visible by comparing the intended angle (45 degrees) against the actual rendered result (about 58.31 degrees) - exactly the kind of silent, plausible-looking wrong answer that's hardest to catch through casual inspection, since both the input and the output look individually sensible. WHY THIS IS PARTICULARLY INSIDIOUS AT SMALL ANGLE VALUES ------------------------------ Because degrees and radians are both just numbers with no attached unit type in most programming languages, there is nothing in the code itself that would flag the mismatch - the function simply receives 45 and treats it as radians, exactly as it's designed to. The mistake is entirely a matter of which convention the caller and the function each assumed, with no automatic way for the program to detect the disagreement. WHY THIS WORKS AS AN ANSWER ------------------------------ The answer performs the actual radian-to-degree conversion and the necessary modulo-360 reduction to arrive at the precise displayed angle, rather than just asserting "it will be wrong," and explains specifically why neither the input value nor the resulting output value looks suspicious enough on its own to catch the error through casual inspection.