Contents Previous Next Subchapters Current Chapters-> positive negative addition coercion subtraction multiplication division equality ordered logicalOperator matrixMultiplication matrixDivision exponentiation transpose norm stringEquality stringOrdered sequence operationOrder Parent Chapters-> Omatrix6 expression coercion Search Tools-> contents reference index search

Automatic Conversion To A Higher Type

Description
The numeric types in O-Matrix, together with the logical type, have the following order from lowest to highest
Coercion Order
 logical ` ->` char ` ->` int ` ->` real ` ->` double ` ->` complex
Many operators or function that allow arguments of different types provided that all the types are in the set listed above. All of the arguments are converted to the same type, and then operation is performed. The type chosen is the highest type of any of the arguments.

Example
If you enter ```      x = 3.1      y = 1i0      print x + y ``` O-Matrix will respond ```      (3.1,1) ``` In the `print` statement above, O-Matrix converted the left operand to a complex number before adding. The value of x, however, is still real. ``` ```The rules for converting values to each of the possible types, are described in the int , char , real , double , and complex sections.