map_unary_over_comparison Function (ROM Call 0x2E3)

AMS 1.01 or higher estack.h

void map_unary_over_comparison (ESI_Callback_t f, ESI cmptag_ptr);

Calls callback function for both comparison terms and pushes the comparison tag.

map_unary_over_comparison assumes that cmptag_ptr points to a comparison tag. It calls the callback function f twice, passing to it pointers to both comparison terms, i.e. the two expressions below the comparison tag (the callback function should push something to the expression stack). The callback function is applied first to the deeper argument on the stack, then to the shallower argument. Finally, map_unary_over_comparison will push the tag pointed to by cmptag_ptr (one byte) to the expression stack. This function is useful to perform some transformations on both sides of a comparison (e.g. to transform 'n<5' into 'n!<120'). Beware that squaring of both sides of an inequality can cause loss of solutions, and squaring both sides of an equation may introduce spurious solutions!


Uses: next_expression_index, push_quantum
Used by: push_abs, push_acosh, push_asin, push_asinh, push_atan, push_atanh, push_conj, push_cosh, push_exp, push_im, push_ln, push_phase, push_re, push_sign, push_sinh, push_tan, push_tanh, push_factorial