Determine whether registered data type has power-of-two scaling
extern int ssGetDataTypeIsScalingPow2 (SimStruct *S, DTypeId dataTypeId)
SimStruct representing an S-function block.
Data type ID of the registered data type for which you want to know whether the scaling is strictly power-of-two.
This function determines whether the registered data type is scaled strictly by a power of two. Fixed-point numbers can be represented as
real-world value = (slope × integer) + bias,
where the slope can be expressed as
slope = fractional slope × 2exponent.
When bias = 0 and fractional slope = 1, the only scaling factor that remains is a power of two:
real-world value = (2exponent × integer) = (2-fraction length × integer).
Trivial scaling is considered a case of power-of-two scaling, with the exponent being equal to zero.
Many fixed-point algorithms are designed to accept only power-of-two
scaling. For these algorithms, you can call
mdlSetOutputPortDataType, to prevent
unsupported data types from being accepted.
This function errors out when
To use this function, you must include
For more information, see Structure of the S-Function.