
testtype - compares types

Calling sequence:
testtype(expr_1, expr_2)

Parameter:

expr_1, expr_2   --   expressions

Summary:

testtype is used to determine if expressionexpr_1 has a form that matches
expr_2, or if expr_1 can be converted into such a form. If this is the case
then the function returns TRUE, in other cases it returns FALSE.

For this, firstly, the function tests if the domain  that contains the element
expr_1 has a method with the index "testtype". If this is the case then this
method is called with the arguments of testtype as its arguments and the
result is returned. If, however, the method returns the value FAIL or such a
method does not exist, then domattr(expr_2, "testtype")(expr_1, expr_2)
is called -- if expr_2 is a domain then the method is searched for here
otherwise it is searched for in the domain that contains expr_2 -- and this
result is returned.

In the pre-defined basic domains this method is implemented so that the user
can determine with testtype if expr_1 is an element of the domain expr_2.

Furthermore there is the domain NUMERIC which enables the user to check if
expr_1 is a number.

The basic typesdefined in MuPAD are listed in the table ??in the appendix.
testtype is a kernel function.

>>  testtype(x + y, DOM_EXPR);

      TRUE

>>  testtype(2^3, DOM_INT);

      TRUE

>>  testtype(2.3 + 4*I, NUMERIC);

      TRUE

See also:  type, domtype

