Skip to main content

whole_units

Function whole_units 

Source
pub fn whole_units(cost: Cost) -> Cost
Expand description

The weighted cost rounded up to whole units of COST_UNIT: 0 stays 0, 1 to 16 is one unit, 17 to 32 two units, and so on.

This is not a count of edits. The x1.5 factor on the first query byte makes an ordinary (non-neighbouring-key) edit there cost 24, i.e. two units, while a neighbouring-key substitution there costs 12 (one unit) and a transposition 18 (two units); two cheap edits (8 + 8) count as one.