18.14. Infix operators revisited

The following cmavo are discussed in this section:



null operand



null operator



exponential notation

The infix operators presented so far have always had exactly two operands, and for more or fewer operands forethought notation has been required. However, it is possible to use an operator in infix style even though it has more or fewer than two operands, through the use of a pair of tricks: the null operand tu'o and the null operator ge'a. The first is suitable when there are too few operands, the second when there are too many. For example, suppose we wanted to express the numerical negation operator va'a in infix form. We would use:

Example 18.103. 

li tu'o va'a ny. du li no vu'u ny.
The-number (null) additive-inverse n equals the-number zero minus n.
-n = 0 − n

The tu'o fulfills the grammatical requirement for a left operand for the infix use of va'a, even though semantically none is needed or wanted.

Finding a suitable example of ge'a requires exhibiting a ternary operator, and ternary operators are not common. The operator gei, however, has both a binary and a ternary use. As a binary operator, it provides a terse representation of scientific (also called exponential) notation. The first operand of gei is the exponent, and the second operand is the mantissa or fraction:

Example 18.104. 

li cinonoki'oki'o du
The-number three-zero-zero-comma-comma equals
li bi gei ci
the-number eight scientific three.
300,000,000 = 3 × 108

Why are the arguments to gei in reverse order from the conventional symbolic notation? So that gei can be used in forethought to allow easy specification of a large (or small) imprecise number:

Example 18.105. 

gei reno
(scientific) two-zero
10 20

Note, however, that although 10 is far and away the most common exponent base, it is not the only possible one. The third operand of gei, therefore, is the base, with 10 as the default value. Most computers internally store so-called floating-point numbers using 2 as the exponent base. (This has nothing to do with the fact that computers also represent all integers in base 2; the IBM 360 series used an exponent base of 16 for floating point, although each component of the number was expressed in base 2.) Here is a computer floating-point number with a value of 40:

Example 18.106. 

papano bi'eju'u re gei
(one-one-zero base 2) scientific
pipanopano bi'eju'u re ge'a re
(point-one-zero-one-zero base 2) with-base 2
.10102 x 21102