Skip to content
docs
Arxo ↗

Division under an explicit policy

For LLMs7 sections

I want to round an exact quotient once, at a stated precision.

The scenes check a short rule and two separate long cases; rounding happens once, at the stated precision.

Incorrect form
pure function Third(x: Money) -> Money = div_round(x, 3.0, 2);

A rounding mode is mandatory; div_round does not choose it for the author. round(money / 3.0) also does not help: inexact division fails before rounding. A 28-digit context limit of one implementation is not a language rule.

Arxo Law
language "law.core" version "0.2";
package recipes.l.r10 version "0.1.0";
namespace "urn:recipe:l-calc:10";
pure function Third(x: Money) -> Money = div_round(x, 3.0, 2, "HALF_UP");
Facts and choiceQuestionAnswer
1. one money unit among threeThird(1 KZT)0.33 KZT / COMPUTED
2. an integer quotient is still rounded by the policydiv_round(1.0, 8.0, 2, "HALF_UP")0.13 / COMPUTED
3. long explicitly stated precision 28div_round(1.0, 3.0, 28, "DOWN")0.3333333333333333333333333333 / COMPUTED
4. rounding after inexact division is too lateround(1 KZT / 3.0, 2, "HALF_UP")no value / RUNTIME_ERROR
5. long explicitly stated precision 34div_round(1.0, 3.0, 34, "DOWN")0.3333333333333333333333333333333333 / COMPUTED
one money unit split three ways
Arxo Law
test "one money unit split three ways" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
}
evaluate Third(1 KZT);
expect value == 0.33 KZT;
expect evaluation_status == COMPUTED;
}
integer quotient rounded by policy
Arxo Law
test "integer quotient rounded by policy" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
}
evaluate div_round(1.0, 8.0, 2, "HALF_UP");
expect value == 0.13;
expect evaluation_status == COMPUTED;
}
long stated precision 28
Arxo Law
test "long stated precision 28" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
}
evaluate div_round(1.0, 3.0, 28, "DOWN");
expect value == 0.3333333333333333333333333333;
expect evaluation_status == COMPUTED;
}
rounding after inexact division fails
Arxo Law
test "rounding after inexact division fails" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
}
evaluate round(1 KZT / 3.0, 2, "HALF_UP");
expect evaluation_status == RUNTIME_ERROR;
expect issue(INEXACT_DIVISION);
}

Mutation: div_round(x, 3.0, 2, "HALF_UP") → div_round(x, 3.0, 2); expected LDC-E2116. Additional counterfactuals are shown as separate table rows.

An extra scene precision=34 checks the normative expectation: 34 threes. A previous defect that returned 28 threes is closed; now both implementations return 34 threes and their documents match. The scene is an ordinary jointly passing run. The check below executes the same expectation with both runners and pins the parity.

Arxo Law
test "long stated precision 34" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
}
evaluate div_round(1.0, 3.0, 34, "DOWN");
expect value == 0.3333333333333333333333333333333333;
expect evaluation_status == COMPUTED;
}
Python
>>> import runpy
>>> checks = runpy.run_path("docs/recipes/l-calc/resources/check.py")
>>> checks["check_precision"]()
'precision=34; lawc = lawref (34 threes)'

Precision 0…34 is allowed. The defect at precision 34 is closed: both implementations return 34 threes, and the extra long example is the rule, not a qualified failure.

An inexact division fails before any rounding can repair it: rounding after / is too late.

Documentation for Arxo. Writings — blog.arxo.io.

Anonymous visit counts on stats.arxo.io, no cookies.