← unary_minus operator page · numeric/unary_minus/sc/negative_operand

Negative operand 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

- on a negative scalar: -SC_1 with SC_1 = -5.

Manual:

Unary minus: "-(-5) gives 5".

Expected:

SC_r = 5, an Integer: "If the type of the operand is integer then the result has type integer."

script.vtl ⇩

SC_r := -SC_1;

input/scalars.csv ⇩

SC_1
-5

input/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_1", "type": "Integer"}
  ]
}

expected/scalars.json ⇩

{
  "scalars": [
    {
      "name": "SC_r",
      "type": "Integer",
      "value": "5"
    }
  ]
}