Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
math / math-npvOpenRuns on Liberas

Net present value

Net present value Σ cash-flows[t] / (1 + rate)^t for t = 0 … n−1, computed exactly, then rounded once to scale (0 to 20) fractional digits by mode. The first flow is at t = 0 and is not discounted (Excel's NPV(r, v1, …) discounts v1 too; it equals this with flows 0, v1, …). rate is per period as a fraction (0.1 is 10 %); rate and each flow are decimals: an optional -, 1 or more ASCII digits, then optionally . and 1 or more digits; rate at most 20 digits, each flow at most 30; 1 to 1,000 flows. Rounding modes: half-even to nearest, ties to the even digit; half-up ties away from zero; half-down ties toward zero; down toward zero; up away from zero; floor toward −∞; ceiling toward +∞. The text has exactly scale fractional digits (no point when scale is 0), at least one integer digit, no leading zeros, and - only when the rounded value is not zero. The result is value(text). Errors are invalid(reason), in this order: rate not a decimal → syntax, over 20 digits → too-long; more than 1,000 flows → too-long; none → empty; each flow in order: not a decimal → syntax, over 30 digits → too-long; then scale over 20, or rate ≤ −1 → out-of-range.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init math-npv --lang rust
cd math-npv && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)42 lines›
math-npv.wit
package root:component;

world root {
  import liberas:math/types@0.1.0;

  export liberas:math/present-value@0.1.0;
}
package liberas:math@0.1.0 {
  interface types {
    enum rounding {
      half-even,
      half-up,
      half-down,
      down,
      up,
      floor,
      ceiling,
    }

    enum math-error {
      syntax,
      too-long,
      division-by-zero,
      too-large,
      out-of-range,
      not-finite,
      empty,
      too-deep,
    }

    variant number-outcome {
      value(string),
      invalid(math-error),
    }
  }
  interface present-value {
    use types.{rounding, number-outcome};

    npv: func(rate: string, cash-flows: list<string>, scale: u8, mode: rounding) -> number-outcome;
  }
}
Test vectors24›
math-npv.cases.json
[
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 2,
      "cash-flows": [
        "0",
        "-10000",
        "3000",
        "4200",
        "6800"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.08",
      "scale": 2,
      "cash-flows": [
        "-40000",
        "8000",
        "9200",
        "10000",
        "12000",
        "14500"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0",
      "scale": 0,
      "cash-flows": [
        "1",
        "2",
        "3"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "-0.5",
      "scale": 3,
      "cash-flows": [
        "1",
        "1",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "up",
      "rate": "0.05",
      "scale": 4,
      "cash-flows": [
        "100"
      ]
    }
  },
  {
    "args": {
      "mode": "floor",
      "rate": "0.07",
      "scale": 10,
      "cash-flows": [
        "-1000",
        "300.50",
        "400.25",
        "500.125"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 2,
      "cash-flows": [
        "-0.001"
      ]
    }
  },
  {
    "args": {
      "mode": "ceiling",
      "rate": "0.123456789",
      "scale": 20,
      "cash-flows": [
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250",
        "350",
        "-250",
        "-150",
        "-50",
        "50",
        "150",
        "250"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-up",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-down",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "down",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "up",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "floor",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "ceiling",
      "rate": "0.1",
      "scale": 3,
      "cash-flows": [
        "0",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "x",
      "scale": 2,
      "cash-flows": [
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "111111111111111111111",
      "scale": 2,
      "cash-flows": [
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 2,
      "cash-flows": [
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 2,
      "cash-flows": []
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 2,
      "cash-flows": [
        "1",
        "1.",
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 2,
      "cash-flows": [
        "1111111111111111111111111111111"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "0.1",
      "scale": 21,
      "cash-flows": [
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "-1",
      "scale": 2,
      "cash-flows": [
        "1"
      ]
    }
  },
  {
    "args": {
      "mode": "half-even",
      "rate": "-1.5",
      "scale": 2,
      "cash-flows": [
        "1"
      ]
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 24 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 750,000,000 instructions.
  • Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.