Template:Convert/Dual/LoffAonDflip5Soff

00

The Template:Convert/Dual/LoffAonDflip5Soff is a subtemplate of Template:Convert to handle "disp=flip5" for 2-number ranges with "abbr=on" abbreviation mode to show unit symbols. It will both flip and round the conversion to the nearest 5 units, after calculating for optional sigfig=n or n-digit rounding "|n". The result is functionally equivalent to invoking {Convert} twice, to calculate each amount separately, with then dividing by 5, rounding to a whole number, and finally multiplying by 5, to have each left-side amount rounded to the nearest 5 units.

Performance considerations
This template runs essentially at the speed of 3 simple {Convert} operations, by invoking the underlying subtemplates which process the output unit, after the input unit has been decoded into conversion factor {b} passed twice, into the output-unit subtemplate for each of the 2 amounts. The flip5 rounding, to the nearest 5 units, occurs after any optional sigfig=n rounding (or "|n" rounding from parameter 5 or 6). Hence, use of "disp=flip5" does not require removal of any other rounding parameters.

The resulting unit symbol is displayed using Template:Convert/LoffAonSoffu2. Overall, this subtemplate is much more complex than the typical formatter subtemplates of Template:Convert. It allows the output unit-code to be default "def". It also handles fractions in both amounts.