- #1
swartzism
- 103
- 0
I'm in the process of converting some Python code to C and have come across a structure I'm not sure on how to translate:
(This is a hybrid of the two languages)
Does anyone know how to get this fully to C? It is trying to return acos(ang)*RAD_2_DEG and if it catches ValueError, it then checks if ang is less than -1.0 and returns a value of 180 or 0 based on that. Any help would be appreciated.
Thanks in advance.
(This is a hybrid of the two languages)
Code:
try:
return(acos(ang)*RAD_2_DEG);
except ValueError:
if (ang < -1.0)
return(180.0);
else
return(0.0);
Does anyone know how to get this fully to C? It is trying to return acos(ang)*RAD_2_DEG and if it catches ValueError, it then checks if ang is less than -1.0 and returns a value of 180 or 0 based on that. Any help would be appreciated.
Thanks in advance.