PMIX_VALUE_GET_NUMBER(3)
π 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 apmix_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 bestietypeβ 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
valor the datatype the caller provided is not numeric, you get aPMIX_ERR_BAD_PARAMerror thrown back at you π not numeric = not invited. - if the two datatypes match, then the value stored in the
pmix_value_tgets returned in the storage thatdatapoints to. slay, easy. - if the data in
valis numeric but it's a different datatype than the one you asked for, then:- if the data in
valdiffers in sign from what you provided (like, sayvalis holding a negative number but you specifiedPMIX_UINT32), then thePMIX_ERR_CHANGE_SIGNerror comes back at you π - if the data in
valcan fit into the specified datatype, then the data shall be returned. for example, if the datatype invalisPMIX_INT32but the datatype you provided isPMIX_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
valis 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 thePMIX_ERR_LOST_PRECISIONerror.
- if the data in
π 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
π Copyright
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
- ubuntu stonking: libpmix-dev 6.1.1~rc2-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms