Determine whether registered data type has power-of-two scaling
extern int ssGetDataTypeIsScalingPow2 (SimStruct *S, DTypeId dataTypeId)
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.
Note Many fixed-point algorithms are designed to accept only power-of-two scaling. For these algorithms, you can call ssGetDataTypeIsScalingPow2 in mdlSetInputPortDataType and mdlSetOutputPortDataType, to prevent unsupported data types from being accepted.
This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.
To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.