I wanna create a program how to calculate the sine and cosine of a degree.

Math.cos(Math.toRadians(degrees)) works to 269

Math.sin(Math.toRadians(degrees)) works to 179

cos of 269 = -0.017452406437283498

cos of 270 = -1.8369701987210297E-16 (WRONG)

sin of 179 = 0.01745240643728344

sin of 180 = 1.2246467991473532E-16 (WRONG)

Does someone know how I can create a working sin/cos function to infinite?

Thanks,

Dennis