I don't understand what your reference angle should be if your number is on the x-axis or y-axis, like cos 0 or sin 90. I know how to get the reference angle of something like tan 240, its 60.
For any angle between 0 deg and 90 deg the closest part of the x axis is the positive x axis, and the reference angle is just equal to the angle. So the reference angles for 0, 40 deg and 90 deg would respectively be 0, 40 deg and 90 deg.
If the angle was, say, 270 deg, then that angle would be at 90 deg with the x axis and the reference angle would be 90 deg.
If the angle is 180 deg or 360 deg, then it is on the x axis and the reference angle would be 0.