Contract.Skilling.interpolate/3 truncates where the published formula rounds #117

Open
opened 2026-08-05 02:03:00 +00:00 by sickday · 0 comments
Owner

Contract.Skilling.interpolate/3 truncates where the game's published formula
rounds, and the two disagree by 1/256 whenever the interpolation lands on a
fraction of a half or more.

The measurement

The wiki's own Module:Skilling success chart computes

1 + floor(low * (99 - L) / 98 + high * (L - 1) / 98 + 0.5)

Contract.Skilling.interpolate/3 computes floor(x) on already-scaled bases,
which is the same expression without the + 0.5. Over the shipped mining
table that is 902 of 2,178 level/ore combinations where the chance out of
256 is one lower than the published one.

What was done about it, and why not more

Fishing carries its own correctly-rounded Contract.Fishing.interpolate/3
and stores raw wiki parameters rather than pre-scaled ones. It reproduces
every published fishing figure checked against it — monkfish 31.25% at 74,
lobster 16.4% at 40, shrimp 19.14% at 1, shrimp 49.61% at 99.

Woodcutting and mining were deliberately not moved. Both were verified
against their own published charts under the truncating convention and both
have their bases back-solved under it, so changing the shared helper is a
behaviour change to two shipped skills — it wants its own branch and its own
re-verification, not a quiet ride along a fishing diff.

What the next person should establish first

The wiki module keeps both roundings: interp and a truncating
scriptInterp. So it is not impossible that different activities genuinely
differ, and the first question is which of the two mining's published charts
were generated with. Answer that before changing anything — if mining's charts
came from scriptInterp, the current behaviour is right and only the shared
name is misleading.

Two skills now express the same idea two ways, which is the real cost: whoever
adds the next gathering skill has to know which helper to reach for.

Named in Contract.Fishing's moduledoc, which is where the arithmetic is
written out.

`Contract.Skilling.interpolate/3` truncates where the game's published formula rounds, and the two disagree by `1/256` whenever the interpolation lands on a fraction of a half or more. ## The measurement The wiki's own `Module:Skilling success chart` computes 1 + floor(low * (99 - L) / 98 + high * (L - 1) / 98 + 0.5) `Contract.Skilling.interpolate/3` computes `floor(x)` on already-scaled bases, which is the same expression without the `+ 0.5`. Over the shipped mining table that is **902 of 2,178 level/ore combinations** where the chance out of 256 is one lower than the published one. ## What was done about it, and why not more Fishing carries its **own** correctly-rounded `Contract.Fishing.interpolate/3` and stores raw wiki parameters rather than pre-scaled ones. It reproduces every published fishing figure checked against it — monkfish 31.25% at 74, lobster 16.4% at 40, shrimp 19.14% at 1, shrimp 49.61% at 99. Woodcutting and mining were deliberately **not** moved. Both were verified against their own published charts under the truncating convention and both have their bases back-solved under it, so changing the shared helper is a behaviour change to two shipped skills — it wants its own branch and its own re-verification, not a quiet ride along a fishing diff. ## What the next person should establish first The wiki module keeps **both** roundings: `interp` and a truncating `scriptInterp`. So it is not impossible that different activities genuinely differ, and the first question is which of the two mining's published charts were generated with. Answer that before changing anything — if mining's charts came from `scriptInterp`, the current behaviour is right and only the shared name is misleading. Two skills now express the same idea two ways, which is the real cost: whoever adds the next gathering skill has to know which helper to reach for. Named in `Contract.Fishing`'s moduledoc, which is where the arithmetic is written out.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Revenant/Server#117
No description provided.