estack_to_short Function (ROM Call 0x2C7)

AMS 1.01 or higher estack.h

short estack_to_short (CESI ptr, short *value_ptr);

Converts entry on the expression stack to signed short integer.

estack_to_short converts an entry on the expression stack pointed to by ptr (it needs to point to the entry tag) to a signed short integer and stores the result in the location pointed to by value_ptr. Note that the entry need not be represented by POSINT_TAG or NEGINT_TAG: it also may be represented by FLOAT_TAG for example, but the value itself needs to be a whole number. This function does not remove the entry from the stack.

estack_to_short returns 1 if the conversion was successful, 0 in the case of overflow (in this case the stored result will be -32768 or 32767 depending of the direction of the overflow), and -1 if the entry can not be represented as a whole number (in this case the result is undefined).


Uses: estack_to_float, is_whole_number, is0, _bcd_math
Used by: GetValue, cmd_output, push_ans_entry, push_sq_matrix_to_whole_number