trig Function (ROM Call 0x28B)

timath.h

void trig (short option, short deg_flag, const float *xptr, float *sine, float *cosine, float *tangent);

Generic subroutine for calculating trigonometric functions.

trig is a TIOS subroutine which is used internally for calculating trigonometric functions, i.e. in TIOS functions sin, cos, sincos and tan. It calculates simultaneously the sine, the cosine and the tangent of the floating point value pointed to by xptr, and stores the results in floating point destinations pointed to by sine, cosine and tangent. The argument pointed to by xptr is assumed to be specified in radians if deg_flag is 0, or in degrees if deg_flag is 1 (it seems that these two values are only legal values for deg_flag). Parameter option is not very clear to me: TIOS uses option = 1 in sin and sincos, option = 2 in cos, and option = 4 in tan. I don't know what is the difference between option = 1 and option = 2, because both the sine and the cosine are calculated regardless of the value of option. I only noticed that the tangent will not be calculated if option is not equal to 4.

Note: I included the description of this routine here only due to completeness: it is more preferable to call particular trigonometric function instead.


Uses: is_transfinite, _bcd_math
Used by: cos, sin, sincos, tan, handleVarLinkKey, push_trig, ROM Call 0x446