| index_numeric_term | Function (ROM Call 0x2CD)

AMS 1.01 or higher | estack.h

ESI index_numeric_term (CESI ptr);

Searches terms in the expression for a numeric term.

If ptr points to the ADD_TAG, which is a case when it points to an expression of form term1 + term2 + ... (i.e. if the expression is a sum of simpler terms), index_numeric_term returns the pointer to the eventual numeric term in the expression. If the expression is a number, index_numeric_term returns ptr (i.e. the pointer to the expression itself). If ptr does not point to the ADD_TAG (i.e. if the expression is not a sum of simpler terms), or if there are not any numeric terms in the expression, index_numeric_factor returns a pointer to a simple expression which consists only of the number 0 (floating point or integer, depending on whether the approximation mode is active or not).
Note: This function is not implemented to be very universal. TIOS always "reorganizes" expressions on such way that numeric terms are at the beginning of the expression (for example, x+3 will be reorganized into 3+x, although it will be displayed just reversed, i.e. as x+3), and this function assumes that the expression is organized on such way. In other words, it must be in internal canonic form (such expressions always have at most one term with a numeric tag, in which case it is the deepest term). Fortunately, all expressions in argument are always in internal canonic form. However, this is not true after push_parse_text function, nor after an evaluation using NG_rationalESI or NG_approxESI. In other words, results of these commands are not always "correctly" organized. To force converting an expression to the internal canonic form, always call push_internal_simplify after usage of any of the functions mentioned above.

Uses: next_expression_index, Float0Index, Integer0Index, primary_tag_list
Used by: push_exp, push_sin2, push_exponentiate, push_factorial