Division: /
Syntax
op1 / op2
Input parameters
op1 |
the dividend |
op2 |
the divisor |
Examples of valid syntaxes
DS_1 / DS_2
3 / 5
Semantics for scalar operations
The operator addition divides two numbers.
For example:
| 3 / 5
gives 0.6
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. The result has type number.
If op2 is 0 then the operation generates a run-time error.
Examples
Given the operand datasets DS_1, DS_2 and DS_3:
Input DS_1 (see structure)
Id_1 |
Id_2 |
Me_1 |
---|---|---|
10 |
A |
7.6 |
10 |
B |
12.3 |
11 |
A |
25.0 |
11 |
B |
20.0 |
Input DS_2 (see structure)
Id_1 |
Id_2 |
Me_1 |
---|---|---|
10 |
A |
2.0 |
10 |
C |
3.0 |
11 |
B |
1.0 |
Input DS_3 (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 |
Example 1
DS_r := DS_1 / DS_2;
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
---|---|---|
10 |
A |
3.8 |
11 |
B |
20.0 |
Example 2
DS_r := DS_1 / 10;
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
---|---|---|
10 |
A |
0.76 |
10 |
B |
1.23 |
11 |
A |
2.5 |
11 |
B |
2.0 |
Example 3
DS_r := DS_3 [ calc Me_3 := Me_2 / Me_1 ];
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
Me_2 |
Me_3 |
---|---|---|---|---|
10 |
A |
100 |
7.6 |
0.076 |
10 |
B |
10 |
12.3 |
1.23 |
11 |
A |
20 |
25.0 |
1.25 |
11 |
B |
2 |
20.0 |
10.0 |