Static Unit Checking |
Static unit checking refers to the process by which Mathcad internally balances the units for equations in your worksheets. Expressions are balanced before calculation to ensure consistent results when using units. This guarantees unit correctness without the need to perform a single calculation. In addition, static unit checking can speed up large, iterative calculations.
In most cases, static unit checking does not substantially impact calculation of a worksheet. The most-visible change is that unit-balancing errors can now appear on a function's definition, rather than its evaluation. Some instances where static unit checking can substantially impact your worksheets are:
Conditional statements in programs cannot return values of different dimensions. Problematic practices include using the on error operator to trap and correct unit errors, and defining variables with different dimensions on the conditional branches.
When you fail to properly account for all possible inputs to a conditional block, Mathcad must "guess" the definition in any undefined instance. The assumed definition is generally the result of the previous instruction in the program. This may cause the conditional to return an inconsistently-united result.
To unit balance an exponential or derivative equation before evaluation, the units of the result must depend only on the units of the arguments, not on their numeric value.
Mathcad requires that you specify the step size when you define a united range variable. For example, the definition
x := 0ft..5ft
must be written as
x := 0ft,1ft..5ft
for Mathcad to accept it.
You can find more information on the effects of static unit checking, including information on how you can rewrite problematic worksheets, in the Migration Guide, found in the Tutorials section of the Mathcad Resources.