← trunc operator page · numeric/trunc/sc_digits/drops_after_fourth_decimal

Drops after fourth decimal 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

trunc of a scalar with numDigit given: trunc(SC_1, SC_2) with SC_1 = 3.14159 and SC_2 = 4.

Manual:

Truncation: "trunc ( 3.14159, 4 ) gives 3.1415".

Expected:

SC_r = 3.1415, a Number: the fourth decimal is kept and the rest dropped.

script.vtl ⇩

SC_r := trunc(SC_1, SC_2);

input/scalars.csv ⇩

SC_1SC_2
3.141594

input/scalars.json ⇩

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

expected/scalars.json ⇩

{
  "scalars": [
    {
      "name": "SC_r",
      "type": "Number",
      "value": "3.141500"
    }
  ]
}