Skip to content

Commit

Permalink
add division, fix multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
amattioc committed Apr 8, 2024
1 parent 62be353 commit 5fcd00d
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 1 deletion.
56 changes: 56 additions & 0 deletions v2.1/docs/operators/Division/content.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
------
Syntax
------
.. code-block:: text
op1 / op2
----------------
Input parameters
----------------
.. list-table::

* - op1
- the dividend
* - op2
- the divisor

------------------------------------
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.
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.
5 changes: 5 additions & 0 deletions v2.1/docs/operators/Division/examples/ds_1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ds_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
4 changes: 4 additions & 0 deletions v2.1/docs/operators/Division/examples/ds_2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Id_1,Id_2,Me_1,Me_2
10,A,1,2.0
10,C,5,3.0
11,B,2,1.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ds_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
3 changes: 3 additions & 0 deletions v2.1/docs/operators/Division/examples/ex_1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Id_1,Id_2,Me_1,Me_2
10,A,100,3.8
11,B,1,20.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ex_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ex_1.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DS_r := DS_1 / DS_2
5 changes: 5 additions & 0 deletions v2.1/docs/operators/Division/examples/ex_2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Id_1,Id_2,Me_1,Me_2
10,A,10,0.76
10,B,1,1.23
11,A,2,2.5
11,B,0.2,2.0
1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ex_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ex_2.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DS_r := DS_1 / 10
5 changes: 5 additions & 0 deletions v2.1/docs/operators/Division/examples/ex_3.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ex_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/ex_3.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DS_r := DS_1 [ calc Me_3 := Me_2 / Me_1 ]
1 change: 1 addition & 0 deletions v2.1/docs/operators/Division/examples/intro.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Given the operand datasets DS_1 and DS_2:
2 changes: 1 addition & 1 deletion v2.1/docs/operators/Multiplication/examples/ex_3.vtl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DS_r := DS_1 [ calc Me_3 := Me_1 + 3.0 ]
DS_r := DS_1 [ calc Me_3 := Me_1 * Me_2 ]

0 comments on commit 5fcd00d

Please sign in to comment.