MATLAB: Does the Data Type Conversion block not convert very small numbers to boolean zeros in Simulink 7.1 (R2008a)

booleanconversiondataroundingsimulinktype

I use the Data Type Conversion block to convert values of data type double to data type boolean.
I configure the block with the following options:
– Output data type: boolean
– Input and output to have equal: Real World Value (RWV)
– Round integer calculations toward: Nearest
I expect an input value of 0.1 to be converted to a boolean 0, but it is converted to a boolean 1.
Any value other than zero is converted to boolean 1, with any setting in the block.

Best Answer

The ability to round small numbers to zero using the Data Type Conversion block is not available in Simulink.
To work around the issue, one may use the Rounding Function block before the Data Type Conversion block to obtain the expected boolean value. Please see the attached Simulink model for an example which illustrates this behavior.