FPToleranceStrategy

Specify whether to check for floating-point tolerance based on relative error or ULP error

Settings

Use this setting to specify the tolerance strategy for checking the numerical accuracy in the generated test bench. Based on the tolerance strategy that you specify, you can enter a custom tolerance value.

'relative' (default)

When you verify the generated code, HDL Coder™ checks for the floating-point tolerance based on the relative error.

'ulp'

When you verify the generated code, HDL Coder checks for the floating-point tolerance based on the ULP error.

Set or View This Property

To set this property, use hdlset_param or makehdl. To view the property value, use hdlget_param.

Example

To specify the floating-point tolerance value for a model, use the hdlset_param function to specify the tolerance strategy, and then enter the tolerance value. For example, to check the floating-point tolerance based on ULP error and enter the tolerance value:

% check for floating-point tolerance based on the ULP error
hdlset_param('sfir_single', 'FPToleranceStrategy', 'ULP');   

% When using ULP error, optionally enter tolerance value greater than or equal to 0        
hdlset_param('FP_test_16a', 'FPToleranceValue', 1);