Jump to main content

##

# 3.9.9 mcUtils_FloatToValueShiftPair

## C

    /* Convert a float value to a fixed-point integer value */
    void mcUtils_FloatToValueShiftPair( const float32_t input, int16_t * const value, uint16_t * const shift )

## Summary

This function convert a float value to a fixed-point integer value.

## Description

This function convert a float value to a fixed-point integer value and its corresponding shift amount.

## Precondition

None.

## Parameters

Param | Description
--- | ---
input | Input Float value to convert.
value | A pointer to an integer where the converted value will be stored.
shift | A pointer to an integer where the shift amount will be stored.

## Returns

None

## Example

    float32_t input = 0.125f;
    int16_t value;
    uint16_t shift;

    mcUtils_FloatToValueShiftPair(input, &value, &shift);

## Remarks

None.