Scaling converts a raw measurement into engineering units. For a zero-based range, divide by the raw span and multiply by the display span. Test zero and the top of the range first, then use a fractional reading to catch an inverted ratio. Preserve decimals instead of rounding intermediate values into a different process result.
A raw value equal to the configured span represents 100 percent. One quarter of that span represents 25 percent, even if the raw reading contains a decimal. Dividing by the wrong span can be difficult to notice near zero, so the hidden check also uses readings in the interior of the range.
Read the tag list and the requested sequence before editing.