Arctangent (output in radians).
+B<ATAN2>
+
+Arctangent of y,x components (output in radians).
+This pops one element from the stack, the x (cosine) component, and then
+a second, which is the y (sine) component.
+It then pushes the arctangent of their ratio, resolving the ambiguity between
+quadrants.
+
+Example: C<CDEF:angle=Y,X,ATAN2,RAD2DEG> will convert C<X,Y>
+components into an angle in degrees.
+
B<FLOOR, CEIL>
Round down or up to the nearest integer.
-Z<>
+B<DEG2RAD, RAD2DEG>
+
+Convert angle in degrees to radians, or radians to degrees.
=item Set Operations
add_op(OP_NOW,NOW)
add_op(OP_LTIME,LTIME)
add_op(OP_TIME,TIME)
+ add_op(OP_ATAN2,ATAN2)
add_op(OP_ATAN,ATAN)
add_op(OP_SQRT,SQRT)
add_op(OP_SORT,SORT)
add_op(OP_REV,REV)
add_op(OP_TREND,TREND)
+ add_op(OP_RAD2DEG,RAD2DEG)
+ add_op(OP_DEG2RAD,DEG2RAD)
#undef add_op
}
(*str)[offset] = '\0';
match_op(OP_ISINF,ISINF)
match_op(OP_NOW,NOW)
match_op(OP_TIME,TIME)
+ match_op(OP_ATAN2,ATAN2)
match_op(OP_ATAN,ATAN)
match_op(OP_SQRT,SQRT)
match_op(OP_SORT,SORT)
match_op(OP_REV,REV)
match_op(OP_TREND,TREND)
+ match_op(OP_RAD2DEG,RAD2DEG)
+ match_op(OP_DEG2RAD,DEG2RAD)
#undef match_op
stackunderflow(0);
rpnstack -> s[stptr] = atan(rpnstack -> s[stptr]);
break;
+ case OP_RAD2DEG:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = 57.29577951 * rpnstack -> s[stptr];
+ break;
+ case OP_DEG2RAD:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = 0.0174532952 * rpnstack -> s[stptr];
+ break;
+ case OP_ATAN2:
+ stackunderflow(1);
+ rpnstack -> s[stptr-1]= atan2(
+ rpnstack -> s[stptr-1],
+ rpnstack -> s[stptr]);
+ stptr--;
+ break;
case OP_COS:
stackunderflow(0);
rpnstack -> s[stptr] = cos(rpnstack -> s[stptr]);
OP_COS,OP_LOG,OP_EXP,OP_LT,OP_LE,OP_GT,OP_GE,OP_EQ,OP_IF,
OP_MIN,OP_MAX,OP_LIMIT, OP_FLOOR, OP_CEIL,
OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT,
- OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND};
+ OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND,
+ OP_ATAN2,OP_RAD2DEG,OP_DEG2RAD};
typedef struct rpnp_t {
enum op_en op;