← modulo operator page · numeric/modulo/sc_comp/integer_mod_integer

Integer mod integer 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

the remainder of a scalar divided by an Integer component, inside calc.

Manual:

Modulo: "If the type of both operands is integer then the result has type integer."

Expected:

Me_3 = mod(11, Me_1): 11 mod 7 = 4, 11 mod 9 = 2 and 11 mod 10 = 1, an Integer; the other components are kept.

script.vtl ⇩

DS_r := DS_1[calc Me_3 := mod(11, Me_1)];

input/DS_1.csv ⇩

Id_1Me_1Me_2
172.5
294.0
3103.5

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1Me_2Me_3
172.5000004
294.0000002
3103.5000001

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"},
        {"name": "Me_2", "type": "Number", "role": "Measure"},
        {"name": "Me_3", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}