Multiplication: *
Syntax
op1 * op2
Input parameters
op1 |
the multiplicand |
op2 |
the multiplier |
Examples of valid syntaxes
DS_1 * DS_2
3 * 5
Semantics for scalar operations
The operator addition returns the product of two numbers. For example:
3 * 5
gives 15
Input parameters type
op1, op2
dataset { measure<number> _+ }
| component<number>
| number
Result type
result
dataset { measure<number> _+ }
| component<number>
| number
Additional Constraints
None.
Behavior
The operator has the behaviour of the “Operators applicable on two Scalar Values or Data Sets or Data Set Components” (see the section “Typical behaviours of the ML Operators”). According to the general rules about data types, the operator can be applied also on sub-types of number, that is the type integer. If the type of both operands is integer then the result has type integer. If one of the operands is of type number, then the other operand is implicitly cast to number and therefore the result has type number.
Examples
Given the operand datasets DS_1 and DS_2:
Input DS_1 (see structure)
Id_1 |
Id_2 |
Me_1 |
Me_2 |
---|---|---|---|
10 |
A |
100 |
7.6 |
10 |
B |
10 |
12.3 |
11 |
A |
20 |
25.0 |
11 |
B |
2 |
20.0 |
Input DS_2 (see structure)
Id_1 |
Id_2 |
Me_1 |
Me_2 |
---|---|---|---|
10 |
A |
1 |
2.0 |
10 |
C |
5 |
3.0 |
11 |
B |
2 |
1.0 |
Example 1
DS_r := DS_1 * DS_2;
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
Me_2 |
---|---|---|---|
10 |
A |
100 |
15.2 |
11 |
B |
4 |
20.0 |
Example 2
DS_r := DS_1 * -3;
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
Me_2 |
---|---|---|---|
10 |
A |
-300 |
-22.8 |
10 |
B |
-30 |
-36.9 |
11 |
A |
-60 |
-75.0 |
11 |
B |
-6 |
-60.0 |
Example 3
DS_r := DS_1 [ calc Me_3 := Me_1 * Me_2 ];
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
Me_2 |
Me_3 |
---|---|---|---|---|
10 |
A |
100 |
7.6 |
760.0 |
10 |
B |
10 |
12.3 |
123.0 |
11 |
A |
20 |
25.0 |
500.0 |
11 |
B |
2 |
20.0 |
40.0 |