# The PropertyResolver Class¶

Examples are just a click away

Boxes like this link to example code.

class fixedpoint.properties.PropertyResolver

Resolves properties between two FixedPoints.

This is used internally by the FixedPoint class for property resolution. You should not need to instantiate this class, but it is documented here to show how properties are resolved.

mismatch_alert(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose mismatch_alert properties are to be resolved.

Returns

Resolved mismatch_alert property.

Return type

str

Raises

MismatchError – if mismatch_alert properties of all args do not match, and any argsmismatch_alert property setting is 'error'.

When all args have equivalent mismatch_alert properties, that value is returned. Otherwise, the priority of resolution order is:

1. 'warning'

2. 'error'

3. 'ignore'

If there are mismatches in the mismatch_alert properties, then an alert is issued according to the highest priority mismatch_alert setting in args.

overflow(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose overflow properties are to be resolved.

Returns

Resolved overflow property.

Return type

str

Raises

MismatchError – if overflow or mismatch_alert properties of all args do not match, and any argsmismatch_alert property setting is 'error'.

When all args have equivalent overflow properties, that value is returned. Otherwise, the priority of resolution order is:

1. 'clamp'

2. 'wrap'

If there are mismatches in the mismatch_alert properties, then an alert is issued according to the highest priority mismatch_alert setting in args.

rounding(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose rounding properties are to be resolved.

Returns

Resolved rounding property.

Return type

str

Raises

MismatchError – if rounding or mismatch_alert properties of all args do not match, and any argsmismatch_alert property setting is 'error'.

When all args have equivalent rounding properties, that value is returned. Otherwise, the priority of resolution order is:

1. 'convergent' (if any args are signed, otherwise 'nearest')

2. 'nearest' (if no args are signed, otherwise 'convergent')

3. 'down'

4. 'in'

5. 'out'

6. 'up'

If there are mismatches in the mismatch_alert properties, then an alert is issued according to the highest priority mismatch_alert setting in args.

overflow_alert(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose overflow_alert properties are to be resolved.

Returns

Resolved overflow_alert property.

Return type

str

Raises

MismatchError – if mismatch_alert or overflow_alert properties of all args do not match.

When all args have equivalent overflow_alert properties, that value is returned. Otherwise, the priority of resolution order is:

1. 'error'

2. 'warning'

3. 'ignore'

If there are mismatches in the overflow_alert properties, then an alert is issued according to the highest priority mismatch_alert setting in args.

implicit_cast_alert(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose implicit_cast_alert properties are to be resolved.

Returns

Resolved implicit_cast_alert property.

Return type

str

Raises

MismatchError – if mismatch_alert or implicit_cast_alert properties of all args do not match.

When all args have equivalent implicit_cast_alert properties, that value is returned. Otherwise, the priority of resolution order is:

1. 'warning'

2. 'error'

3. 'ignore'

If there are mismatches in the implicit_cast_alert properties, then an alert is issued according to the highest priority mismatch_alert setting in args.

str_base(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose str_base properties are to be resolved.

Returns

Resolved str_base property.

Return type

int

When all args have equivalent str_base properties, that str_base is returned. Otherwise the resolution is 16.

Note

str_base mismatches do not raise MismatchErrors.

all(*args)
Parameters

args (FixedPoint) – An variable number of FixedPoints whose property settings are to be resolved.

Returns

dict of resolved properties.

Return type

dict[str, str]

Raises

MismatchError – if any properties are not equivalent for all args and any argsmismatch_alert property setting is 'error'.

Resolves all properties for each FixedPoint in args.

Return value is a dict, with the format 'property name': 'property setting'. This can be used directly in the FixedPoint constructor as its property keyword arguments.

A mismatch alert is issued for each property mismatch.

Property Resolution Order

The order in which properties are resolved (and thus the order in which alerts may be issued) is: