Return total slope of scaling of registered data type
extern double ssGetDataTypeTotalSlope (SimStruct *S, DTypeId dataTypeId)
Fixed-point numbers can be represented as
real-world value = (slope × integer) + bias,
where the slope can be expressed as
slope = fractional slope × 2exponent.
This function returns the total slope, rather than the fractional slope, of the data type designated by dataTypeId. To get the fractional slope, use ssGetDataTypeFracSlope:
If the registered data type has trivial scaling, including double and single data types, the function returns a total slope of 1.
If the registered data type is ScaledDouble, the function returns the total slope of the nonoverridden data type. Refer to the examples below.
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.
The data type sfix32_En4 becomes flts32_En4 with data type override. The total slope returned by this function in either case is 0.0625 (2-4).
The data type ufix16_s7p98 becomes fltu16_s7p98 with data type override. The total slope returned by this function in either case is 7.98.