# symforce.test_util.epsilon_handling module#

is_value_with_epsilon_correct(func, singularity=0, limit_direction='+', display_func=<built-in function print>, expected_value=None)[source]#

Check epsilon handling for the value of a function that accepts a single value and an epsilon.

For epsilon to be handled correctly, the function must evaluate to a non-singularity at x=singularity given epsilon

Parameters:
• func (Callable[[float, float], Expr]) – A callable func(x, epsilon) with a singularity to test

• singularity (float) – The location of the singularity in func

• limit_direction (str) – The side of the singularity to test, defaults to right side only

• display_func (Callable[[Any], None] | None) – Function to call to display an expression or a string

• expected_value (float | None) – The expected value at the singularity, if not provided it will be computed as the limit

Return type:

bool

is_derivative_with_epsilon_correct(func, singularity=0, limit_direction='+', display_func=<built-in function print>, expected_derivative=None)[source]#

Check epsilon handling for the derivative of a function that accepts a single value and an epsilon.

For epsilon to be handled correctly, a linear approximation of the original must match that taken with epsilon then substituted to zero

Parameters:
• func (Callable[[float, float], Expr]) – A callable func(x, epsilon) with a singularity to test

• singularity (float) – The location of the singularity in func

• limit_direction (str) – The side of the singularity to test, defaults to right side only

• display_func (Callable[[Any], None] | None) – Function to call to display an expression or a string

• expected_derivative (float | None) – The expected derivative at the singularity, if not provided it will be computed as the limit

Return type:

bool

is_epsilon_correct(func, singularity=0, limit_direction='+', display_func=<built-in function print>, expected_value=None, expected_derivative=None)[source]#

Check epsilon handling for a function that accepts a single value and an epsilon.

For epsilon to be handled correctly, the function must:
1. evaluate to a non-singularity at x=singularity given epsilon

2. linear approximation of the original must match that taken with epsilon then substituted to zero

Parameters:
• func (Callable[[float, float], float]) – A callable func(x, epsilon) with a singularity to test

• singularity (float) – The location of the singularity in func

• limit_direction (str) – The side of the singularity to test, defaults to right side only

• display_func (Callable[[Any], None] | None) – Function to call to display an expression or a string

• expected_value (float | None) – The expected value at the singularity, if not provided it will be computed as the limit

• expected_derivative (float | None) – The expected derivative at the singularity, if not provided it will be computed as the limit

Return type:

bool