#ifndef SCPI_NUMERIC_TYPES_H
#define SCPI_NUMERIC_TYPES_H    
    // @uNumericValue_t
    // Describes a numeric value in various types of implementation
    #pragma pack(push, 8)
    typedef union
    {
       long double demicalFloat;  // eScpiEntityTypeDemicalFloatNumber, eScpiEntityTypeDemicalExpNumber
       long double f;             // eScpiEntityTypeDemicalFloatNumber, eScpiEntityTypeDemicalExpNumber
       long long demicalInteger;  // eScpiEntityTypeDemicalIntegerNumber, eScpiEntityTypeHexNumber, eScpiEntityTypeOctNumber, eScpiEntityTypeBinNumber
       long long i;               // eScpiEntityTypeDemicalIntegerNumber, eScpiEntityTypeHexNumber, eScpiEntityTypeOctNumber, eScpiEntityTypeBinNumber
    }
    uNumericValue_t;
    #pragma pack(pop)

    // @eScpiNumericLimitType_t
    // Defines the type of numeric range @sNumericRange_t
    typedef enum
    {
       SCPI_NUMERIC_LIMIT_TYPE__INVALID = 0,   //  ----------------

       SCPI_NUMERIC_LIMIT_TYPE__BI      = 1,   //  ---- integers --
       SCPI_NUMERIC_LIMIT_TYPE_I8       = 1,   //   8-bit integer
       SCPI_NUMERIC_LIMIT_TYPE_I16      = 2,   //  16-bit integer
       SCPI_NUMERIC_LIMIT_TYPE_I32      = 3,   //  32-bit integer
       SCPI_NUMERIC_LIMIT_TYPE_I64      = 4,   //  64-bit integer
       SCPI_NUMERIC_LIMIT_TYPE__EI      = 4,   //  ----------------

       SCPI_NUMERIC_LIMIT_TYPE__BF      = 5,   //  ---- floats ----
       SCPI_NUMERIC_LIMIT_TYPE_F32      = 5,   //  32-bit float
       SCPI_NUMERIC_LIMIT_TYPE_F64      = 6,   //  64-bit float
       SCPI_NUMERIC_LIMIT_TYPE__EF      = 6,   //  - end of float -

       SCPI_NUMERIC_LIMIT_TYPE__END     = 7,   //  ---------------
    }
    eScpiNumericLimitType_t;
    #define SCPI_NUMERIC_LIMIT_TYPE_IS_FLOAT(_type_)   (((_type_)>=SCPI_NUMERIC_LIMIT_TYPE__BF)&&((_type_)<=SCPI_NUMERIC_LIMIT_TYPE__EF))
    #define SCPI_NUMERIC_LIMIT_TYPE_IS_INTEGER(_type_) (((_type_)>=SCPI_NUMERIC_LIMIT_TYPE__BI)&&((_type_)<=SCPI_NUMERIC_LIMIT_TYPE__EI))

    // @sNumericRange_t
    // Describes a range of numeric values
    typedef struct
    {
       uNumericValue_t min;
       uNumericValue_t max; 
       uint8_t type;          // eScpiNumericLimitType_t
    }
    sNumericRange_t;

    // @sNumericEntry_t
    // Describes a numeric value with the type
    typedef struct
    {
        uNumericValue_t Value; // value, depends on @valueType
        char valueType;  // Entity type, [eScpiEntityType_t]
        uint8_t error;   // Conersion result, [eScpiNumericConversionError_t]
    }
    sNumericEntry_t;
  
    typedef enum
    {
        ScpiNumericSuccess,              // no numeric conversion error
        ScpiNumericInvalidArg,           // invalid arguments (internal)
        ScpiNumericError,                // generic numeric conversion error
        ScpiNumericError_DEVICE_RANGE,   // the value is out of range supported by device
        ScpiNumericError_USER_RANGE,     // the value is out of user specified range 
        ScpiNumericError_USER_TYPE,      // the value does not match to the user expectation
    }
    eScpiNumericConversionError_t;

    // @sProcessNumericEntry_t
    // The @processNumericArgument routine context structure
    // Internal context for numbers conversion
    typedef struct
    {
        sNumericEntry_t valueEntry;

        char numberBuffer[ SCPI_MAX_NUMBER_LENGTH ];
    }
    sProcessNumericEntry_t;
#endif