* (multiplicand multiplier -- product)
Inputs
multiplicand: Left multiplicative factor.multiplier: Right multiplicative factor.
Outputs
product: Product object.
This builtin accepts whole and real numbers. Both inputs are dereferenced and must be non-NIL. The operands must have the same schema.
Behavior
- Whole-number schemas use integer multiplication semantics.
- Real schemas use floating-point multiplication semantics.
- If both operands are known at compile time, the result is computed at compile time.
- If either operand is known
0, the result is known0of the same schema, even when the other operand is unknown. - If either operand is known
1, the result follows the other operand's value and schema. - Otherwise, the builtin produces an unknown result of the same schema.
Example
{} () {} [
unknownInt: 7 dynamic;
"-- int32 --" printCompilerMessage
3 4 * printStack _:;
0 7 * printStack _:;
1 7 * printStack _:;
"-- zero and unknown int32 --" printCompilerMessage
0 unknownInt * printStack _:;
unknownInt 0 * printStack _:;
"-- real32 --" printCompilerMessage
2.5r32 4.0r32 * printStack _:;
] "main" exportFunction
Expected Output During Compilation
-- int32 --
12
0
7
-- zero and unknown int32 --
0
0
-- real32 --
10.0r32
See also
+builtin(left right -- sum)Adds two numeric objects.-builtin(minuend subtrahend -- difference)Subtracts the second numeric object from the first./builtin(dividend divisor -- quotient)Divides numeric objects within the same schema; Whole division stays whole, while Real schemas use floating division.modbuiltin(dividend divisor -- remainder)Computes the remainder of numeric division; signed Int, unsigned Nat, and Real objects each follow their own remainder semantics.negbuiltin(object -- negatedValue)Negates a signed Int or Real object and keeps the same schema.