| Home | Libraries | People | FAQ | More

## Policies

Policies are a powerful fine-grain mechanism that allow you to customise the behaviour of this library according to your needs. There is more information available in the policy tutorial and the policy reference.

Generally speaking, unless you find that the default policy behaviour when encountering 'bad' argument values does not meet your needs, you should not need to worry about policies.

Policies are a compile-time mechanism that allow you to change error-handling or calculation precision either program wide, or at the call site.

Although the policy mechanism itself is rather complicated, in practice it is easy to use, and very flexible.

Using policies you can control:

- How results from 'bad' arguments are handled, including those that cannot be fully evaluated.
- How accuracy is controlled by internal promotion to use more precise types.
- What working precision should be used to calculate results.
- What to do when a mathematically undefined function is used: Should this raise a run-time or compile-time error?
- Whether discrete functions, like the binomial, should return real or only integral values, and how they are rounded.
- How many iterations a special function is permitted to perform in a series evaluation or root finding algorithm before it gives up and raises an evaluation_error.

You can control policies:

- Using macros to change any default policy: the is the prefered method for installation wide policies.
- At your chosen namespace scope for distributions and/or functions: this is the prefered method for project, namespace, or translation unit scope policies.
- In an ad-hoc manner by passing a specific policy to a special function, or to a statistical distribution.