Contenuto principale

ssGetDataTypeIsScalingTrivial

Determine whether scaling of registered data type is slope = 1, bias = 0

Syntax

extern int ssGetDataTypeIsScalingTrivial (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 whether the scaling is trivial.

Description

This function determines whether the scaling of a registered data type is trivial. In [Slope Bias] representation, fixed-point numbers can be represented as

real-world value = (slope × integer) + bias.

In the trivial case, slope  =  1 and bias  =  0.

In terms of binary-point-only scaling, the binary point is to the right of the least significant bit for trivial scaling, meaning that the fraction length is zero:

real-world value = integer × 2–fraction length = integer × 20.

In either case, trivial scaling means that the real-world value is simply equal to the stored integer value:

real-world value = integer.

Scaling is always trivial for pure integers, such as int8, and also for the true floating-point types single and double.

This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.

Requirements

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

  • To build an S-function that utilizes this function, you must compile it using the mex function with -lfixedpoint argument. For more information, see Create MEX Files.

Languages

C

TLC Functions

FixPt_DataTypeIsScalingTrivial

Version History

Introduced before R2006a