← division operator page · numeric/division/sc_comp/scalar_dividend

Scalar dividend 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a scalar divided by a component, so the order matters.

Manual:

Division: op1 is "the dividend" and op2 is "the divisor", and "The result has type number."

Expected:

Me_3 = 10 / Me_1 is 5.0, 2.5 and 2.0, a Number; the other components are kept.

script.vtl ⇩

DS_r := DS_1[calc Me_3 := 10 / Me_1];

input/DS_1.csv ⇩

Id_1Me_1Me_2
122.5
244.0
350.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
122.5000005.000000
244.0000002.500000
350.5000002.000000

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": "Number", "role": "Measure"}
      ]
    }
  ]
}