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:

  1. Programs containing conditional statements that return output of varying units.

    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.

  2. Programs that rely on incomplete conditional definitions.

    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.

  3. Values with units raised to a variable power.

    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.

  4. Range variables defined with units.

    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.

Migration Guide: Units in Functions and Operators