When the test case does not fail even if the expected value and the output value of the floating variable are different.

In Controller Tester, the tolerance of floating variables is set to the 6th place after the decimal point. For example, if the expected value is 3.14159265 and the output value is 3.14159274, Controller Tester determines that the expected value and the output value are the same, and the test case is successful.You can change the tolerance in the following way.

  • Open %project_path%\.csdata\ut.ini file and modify the value of FLOAT_TOLERANCE.
    • In the example above, modify to FLOAT_TOLERANCE=0.0000001.

When the expected value and the output value of a floating variable are the same but the test case fails.

When Controller Tester handles float variables, an error can occur because it casts float variables to double. This problem can be solved in two ways.

  1. Modify declaration of float variable to declaration of double variable.
  2. Modify codescroll_flt type from long double to float.
    • Open the .info file of the used toolchain in ‘Preferences’ > ‘ToolChain’ > ‘Open Configuration Folder’ and modify as the below.
// Before modification
#typeName,valueKind,min,max,size,csType
long double,float,2.22507e-308,1.79769e+308,8,codescroll_flt

// After modification
#typeName,valueKind,min,max,size,csType
float,float,2.22507e-308,1.79769e+308,8,codescroll_flt

When calculating the value of a floating variable using a constant, the operation result is incorrect.

If you use constants in expressions, Controller Tester converts real numbers to integers and calculates them. When doing calculations using constants, you need to change an option so that real numbers are not converted to integers.

  • Open .ini file of the used toolchain in ‘Preferences’ > ‘ToolChain’ > ‘Open Configuration Folder’ and modify as the below.
    leave_float_literal = 0 -> leave_float_literal = 1

This problem can occur when using RTV project or RTV target project.

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.