Main Content

ssFxpConvertFromRealWorldValue

Convert value of data type double to another data type

Syntax

extern void ssFxpConvertFromRealWorldValue
                              (SimStruct *S,
                               void *pVoidDest,
                               size_t sizeofDest,
                               DTypeId dataTypeIdDest,
                               double dblRealWorldValue,
                               fxpModeRounding roundMode,
                               fxpModeOverflow overflowMode,
                               fxpOverflowLogs *pFxpOverflowLogs)

Arguments

S

SimStruct representing an S-function block.

pVoidDest

Pointer to the converted value.

sizeofDest

Size in memory of the converted value.

dataTypeIdDest

Data type ID of the converted value.

dblRealWorldValue

Double value you want to convert.

roundMode

Rounding mode you want to use if a loss of precision is necessary during the conversion. Possible values are FXP_ROUND_CEIL, FXP_ROUND_CONVERGENT, FXP_ROUND_FLOOR, FXP_ROUND_NEAR, FXP_ROUND_NEAR_ML, FXP_ROUND_SIMPLEST and FXP_ROUND_ZERO.

overflowMode

Overflow mode you want to use if overflow occurs during the conversion. Possible values are FXP_OVERFLOW_SATURATE and FXP_OVERFLOW_WRAP.

pFxpOverflowLogs

Pointer to the fixed-point overflow logging structure.

Description

This function converts a double value to any registered built-in or fixed-point data type.

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

None

Version History

Introduced before R2006a