Main Content

ssGetDataTypeFracSlope

Return fractional slope of registered data type

Syntax

extern double ssGetDataTypeFracSlope(SimStruct *S, DTypeId
                                     dataTypeId)

Arguments

S

SimStruct representing an S-function block.

dataTypeId

Data type ID of the registered data type for which you want to know the fractional slope.

Description

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 fractional slope of a registered fixed-point data type. To get the total slope, use ssGetDataTypeTotalSlope:

  • For power-of-two scaling, the fractional slope is 1.

  • If the data type has trivial scaling, including data types single and double, the fractional slope is 1.

  • If the registered data type is ScaledDouble, the fractional slope returned is that of the nonoverridden data type.

This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.

Requirement

To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.

Languages

C

TLC Functions

FixPt_DataTypeFracSlope

Version History

Introduced before R2006a