PMIX_VALUE_GET_NUMBER(3)

πŸ“¦ version 6.1.1~rc2, in ubuntu stonking

πŸ’– NAME πŸ’–

okay so welcome to the PMIX_VALUE_GET_NUMBER(3) page of the OpenPMIx manual bestie 🫢 (that's the manual name btw, PMIX_VALUE_GET_NUMBER(3), in case the vibe check needed it).

PMIx_Value_get_number β€” pulls a numerical value out of a pmix_value_t. that's it. that's the whole job. ✨


🌸 SYNOPSIS 🌸

#include <pmix.h>

pmix_status_t PMIx_Value_get_number(const pmix_value_t *val,
                                    void *dest,
                                    pmix_data_type_t type;

(no, that trailing ; is not my typo era, I am literally copying the page, do not come for me πŸ™ˆ)

🐍 Python Syntax

there is no Python equivalent, periodt. the pmix_value_t equivalent in Python is just a dictionary with a value field and a type field, so writing a whole function for it would be doing the most for no reason. unnecessary, so nobody did it πŸ’…


πŸŽ€ INPUT PARAMETERS πŸŽ€

  • val β€” pointer to a pmix_value_t(5) struct that's holding the numerical value you wanna extract. note that the struct you hand over will not be altered in any way β€” she comes back untouched, iconic behaviour πŸ‘‘
  • data β€” pointer to the spot where the data value gets returned. bring your own memory bestie
  • type β€” the PMIx datatype you expect the extracted value to be

πŸ¦‹ DESCRIPTION πŸ¦‹

so PMIx_Value_get_number takes the datatype you gave it, compares it against the datatype it found living inside val, and then picks one of these little paths:

  • if either the datatype in val or the datatype the caller provided is not numeric, you get a PMIX_ERR_BAD_PARAM error thrown back at you 😭 not numeric = not invited.
  • if the two datatypes match, then the value stored in the pmix_value_t gets returned in the storage that data points to. slay, easy.
  • if the data in val is numeric but it's a different datatype than the one you asked for, then:
    • if the data in val differs in sign from what you provided (like, say val is holding a negative number but you specified PMIX_UINT32), then the PMIX_ERR_CHANGE_SIGN error comes back at you πŸ’€
    • if the data in val can fit into the specified datatype, then the data shall be returned. for example, if the datatype in val is PMIX_INT32 but the datatype you provided is PMIX_INT8, the value will be returned if the numeric value is within the range of an 8-bit integer. tiny house, still fits 🏠
    • if the data in val is a floating point value (either float or double) but you specified a non-floating point datatype, the value will be returned in your storage if it fits within the range of that integer type β€” and it gets cast to the matching type before coming back to you. heads up: any fractional portion of the value is lost. gone. evaporated. πŸ™ˆ and if the value lies outside the range of the integer type, then you get the PMIX_ERR_LOST_PRECISION error.

πŸ“ Note

the caller must provide backing memory for the value being returned. this function will not allocate memory for you, she is not your mom. also, this function is only usable when retrieving numerical values β€” for all non-numerical values you should be using the PMIx_Value_unload(3) function instead. iykyk 🌈

πŸ”₯ RETURN VALUE πŸ”₯

returns PMIX_SUCCESS on success πŸŽ‰ on error, a negative value corresponding to a PMIx errno is returned. negative = bad vibes, read the errno.


🌈 EXAMPLES 🌈

unloading an int32_t

pmix_value_t val;
int32_t i32;
pmix_status_t rc;

val.type = PMIX_INT32;
val.data.int32 = 1234;

rc = PMIx_Value_get_number(&val, (void*)&i32, PMIX_INT32);

on return of PMIX_SUCCESS, the variable i32 will contain a value of 1234. πŸŽ€

the same energy, smaller container

pmix_value_t val;
int16_t i16;
pmix_status_t rc;

val.type = PMIX_INT32;
val.data.int32 = 1234;

rc = PMIx_Value_get_number(&val, (void*)&i16, PMIX_INT16);

this would also return PMIX_SUCCESS, with the variable i16 containing a value of 1234, because that value lies within the range of an int16_t. she fits, she ships ✨

float era, losing the decimals

pmix_value_t val;
int32_t i32;
pmix_status_t rc;

val.type = PMIX_FLOAT;
val.data.fval = -1234.567;

rc = PMIx_Value_get_number(&val, (void*)&i32, PMIX_INT32);

this one would return PMIX_SUCCESS, with the variable i32 containing a value of -1234 β€” which truncates the floating number. .567 said bye and left the group chat 😭

but!!! sign conflict

pmix_value_t val;
uint32_t u32;
pmix_status_t rc;

val.type = PMIX_FLOAT;
val.data.fval = -1234.567;

rc = PMIx_Value_get_number(&val, (void*)&u32, PMIX_UINT32);

this would return PMIX_ERR_CHANGE_SIGN, because the sign requirements conflict. a negative trying to fit into an unsigned? not on her watch πŸ’…


πŸ‘€ See also


2014-2026, OpenPMIx Community


and that's the whole page bestie 🫢 you just read PMIX_VALUE_GET_NUMBER(3) from the OpenPMIx manual, dated Aug 04, 2026 β€” love that for you, now go extract some numbers responsibly βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from