Hey! I am currently working on a math project using the arduino, but i've run into a problem. What my code is suposed to do is take x and y coordinates and calculate them into angles. However, when the angles for the sinus go above 90 degrees, it outputs a wrong number. As far as I can tell, it takes whatever it is above the 90 degrees, and subtracts it from 90. What i want it to do is output the right number, but i've completely ran out of ideas. Can anyone help? If it doesn't make sense, sorry, but english isn't my first language `[/`

#include "math.h"

int x =7;

int y =8;

float r1 =11.4;

float r2 =11.9;

float a, b, c, d, e;

const float pi =3.14;

void setup() {

Serial.begin(9600);

c=(x*x+y*y-r1*r1-r2*r2)/(2*r1*r2);

e=acos(c);

b=e*(180/pi);

d=(y*(r1+r2*cos(e))-x*r2*sin(e))/(x*(r1+r2*cos(e))+y*r2*sin(e));

a=atan(d)*(180/pi);

Serial.print("vinkel 1: ");

Serial.println(a);

Serial.print("vinkel 2: ");

Serial.print(b);

}

]