
![]()
See Table 9.1 for the table of contents for this clause.
Table 9.1 -- Table of contents
This International Standard defines a EDCS Unit Conversion Application Program Interface to convert between values given with respect to different EUs and ESs.
Complex data types are formed from simpler data types. These simpler data types represent single pieces of information such as numbers, alphanumeric characters including strings of these, Booleans and other individual data definitions.
There are two basic categories of numbers that are represented in the fundamental data types. These are the floating point number and the integer.
One precision of floating point number is defined:
Long_Float
This type corresponds to the double precision floating point type defined by the IEEE Standard for Binary Floating-Point Arithmetic [754]. However, implementations on architectures which support other floating point representations are allowed.
One precision of integer is defined:
Integer
This type corresponds to the signed integer data type in programming languages.
All implementations which conform to this International Standard shall support at least the minimum ranges specified in Table 9.2.
Table 9.2 -- Minimum value range for Integer data type
|
Data type |
Value range |
|
Integer |
[-2147483648, 2147483647] |
Structured data types are constructed by combining more basic types using structure and array types. The structured data types supported by the EDCS Unit Conversion Application Program Interface are defined in this subclause.
The Unit_Value structure is used as the type for input and output parameters of the Convert_Unit_Value function:
Integer EUC_Type, ESC_Type
Long_Float EDCS_Real
Unit_Value ::=
{ type EUC_Type; // the EUC
scale ESC_Type; // the ESC
value EDCS_Real; }
Selector data types are data types whose values are specified from an ordered list of names. The names are assigned numbers whose values indicate the position within the ordered list. The selector data types supported by the EDCS Unit Conversion Application Program Interface are defined in this subclause.
The Status_Code selector type is used as the type for an output value that tells about the success or failure of the Convert_Quantity_Value function:
Integer Status_type
Status_Code ::= ( 1 : SUCCESS; // the converted quantity value is copied into output_quantity,
// if valid parameters were supplied and the operation succeeded.
2 : INVALID_INPUT_UNIT; // if the input EUC is an invalid value.
3 : INVALID_OUTPUT_UNIT; // if the output EUC is an invalid value.
4 : INVALID_INPUT_SCALE; // if the input ESC is an invalid value.
5 : INVALID_OUTPUT_SCALE; // if the output ESC is an invalid value.
6 : UNITS_NOT_EQUIVALENT; // if the input and output EUC are not members of the same EQ.
7 : FAILURE; // if the quantity value was unable to be converted for a reason
// not covered by another status code }
The following Long_Float (double precision) constants are defined for use by implementations. These constants provide the values from the Quantity / Definition field of the EDCS Unit Dictionary and from the Definition field of the EDCS Scale dictionary in a manner convenient for the preparation of language bindings.
// Conversion factors for EDCS Units Long_Float Constant ANGSTROM_TO_METRE = 1.0D-10 // ISO 31-1:1992, 1-3.a Long_Float Constant ARE_TO_SQ_METRE = 1.0D2 // ISO 31-1:1992, 1-5.a Long_Float Constant ASTRONOMICAL_UNIT_TO_METRE = 1.4959787D11 // ISO 31-1:1992, 1-3.B.b Long_Float Constant BAR_TO_PASCAL = 1.0D5 // ISO 31-3:1992, 3-15a Long_Float Constant BARN_TO_SQ_METRE = 1.0D-28 // ISO 31-10:1992, 10-3.a Long_Float Constant BEL_TO_NEPER = 1.151293 // ISO 31-2:1992, 2-9.b Long_Float Constant CURIE_TO_BECQUEREL = 3.7D10 // ISO 31-9:1992, 9-33.a Long_Float Constant DAY_TO_SECOND = 8.64D4 // ISO 31-0:1992, Table 4 Long_Float Constant DB_TO_BEL = 1.0D-1 // ISO 31-2:1992, 2-9.b Long_Float Constant DB_TO_NEPER = 1.151293D-1 // ISO 31-2:1992, 2-9.b Long_Float Constant DEGREE_ARC_TO_RADIAN = PI/180 // ISO 31-0:1992, Table 4 Long_Float Constant DEGREE_C_HOUR_TO_KELVIN_SECOND = 3.6D3 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant DEGREE_C_OFFSET_TO_KELVIN = 2.7315D2 // ISO 31-4:1992, 4-2.a Long_Float Constant DEGREE_C_PER_HOUR_TO_KELVIN_PER_SEC = 1/3600 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant DEGREE_C_PER_METRE_TO_KELVIN_PER_METRE = 1.0D0 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant DEGREE_C_PER_SEC_TO_KELVIN_PER_SEC = 1.0D0 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant ELECTRONVOLT_M_SQD_PER_KG_TO_JOULE_METRE_SQD_PER_KG = 1.60217733D-19 // ISO 31-10:1992, 10-20.b Long_Float Constant ELECTRONVOLT_M_SQD_TO_JOULE_METRE_SQD = 1.60217733D-19 // ISO 31-10:1992, 10-19.b Long_Float Constant ELECTRONVOLT_TO_JOULE = 1.602177D-19 // ISO 31-0:1992, Table 6 Long_Float Constant FOOT_TO_METRE = 3.048D-1 // ISO 31-1:1992, 1-3.A.b Long_Float Constant GAL_TO_METRE_PER_SEC_SQD = 1.0D-2 // ISO 31-1:1992, 1-11.B.a Long_Float Constant GON_TO_RADIAN = PI/200 // ISO 31-1:1992, 1-1.B.a Long_Float Constant GRAM_PER_CUBIC_CM_TO_KG_PER_CUBIC_METRE = 1.0D3 // ISO 31-3:1992, 3-2.b Long_Float Constant GRAM_PER_CUBIC_M_TO_KG_PER_CUBIC_METRE = 1.0D-3 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant GRAM_PER_GRAM_TO_KG_PER_KG = 1.0D0 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant GRAM_PER_KILOGRAM_TO_KG_PER_KG = 1.0D-3 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant GRAM_TO_KILOGRAM = 1.0D-3 // ISO 31-0:1992, 3.2.4 Long_Float Constant HECTARE_TO_SQ_METRE = 1.0D4 // ISO 31-1:1992, 1-5.a Long_Float Constant HOUR_TO_SECOND = 3.6D3 // ISO 31-0:1992, Table 4 Long_Float Constant INT_SOLAR_FLUX_UNIT_TO_JANSKY = 1.0D4 Long_Float Constant INT_SOLAR_FLUX_UNIT_TO_WATT_PER_SQ_M_HZ = 1.0D-22 Long_Float Constant INV_CUBIC_CM_SEC_TO_INV_CUBIC_METRE_SEC = 1.0D-6 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant INV_CUBIC_CM_TO_INV_CUBIC_METRE = 1.0D-6 // ISO 31-0v, 2.3.2.3 (derived) Long_Float Constant INV_CUBIC_METRE_EV_TO_INV_CUBIC_METRE_JOULE = 6.24150614D18 // ISO 31-13:1992, 13-17.b Long_Float Constant INV_SQ_CM_SEC_SR_EV_TO_INV_SQ_M_SEC_SR_EV = 1.0D-6 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant INV_SQ_CM_SEC_STERADIAN_TO_INV_SQ_M_SEC_STERADIAN = 1.0D-4 // ISO 31-0, 2.3.2.3 (derived) Long_Float Constant JANSKY_TO_WATT_PER_SQ_M_HZ = 1.0D-26 Long_Float Constant JOULE_PER_GRAM_K_TO_JOULE_PER_KG_KELVIN = 1.0D3 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant JOULE_PER_KM_TO_JOULE_PER_METRE = 1.0D-3 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant KELVIN_PER_KM_TO_KELVIN_PER_METRE = 1.0D-3 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant KG_PER_LITRE_TO_KG_PER_CUBIC_METRE = 1.0D-3 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant KILOPOUND_TO_KILOGRAM = 4.5359237D2 // ISO 31-3:1992, 3-1.B.a Long_Float Constant KM_PER_HOUR_TO_METRE_PER_SEC = 10/36 // ISO 31-1:1992, 1-10.b Long_Float Constant KNOT_TO_METRE_PER_SEC = 5.14444D-1 // ISO 31-1:1992, 1-10.b Long_Float Constant LIGHT_YEAR_TO_METRE = 9.460730D15 // ISO 31-1:1992, 1-3.B.a Long_Float Constant LITRE_PER_HOUR_TO_CUBIC_METRE_PER_SEC = 1/3600000 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant LITRE_PER_SECOND_TO_CUBIC_METRE_PER_SEC = 1.0D-3 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant LITRE_TO_CUBIC_METRE = 1.0D-3 // ISO 31-0:1992, Table 4 Long_Float Constant LONG_TON_TO_KILOGRAM = 1.016047D3 // ISO 31-3:1992, 3-1.B.e Long_Float Constant LUMEN_HOUR_TO_LUMEN_SECOND = 3.6D3 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant LUX_HOUR_TO_LUX_SECOND = 3.6D3 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant METRE_PER_HOUR_TO_METRE_PER_SEC = 1/3600 // ISO 31-0:1992, 2.3.2.2 (derived) Long_Float Constant MILE_PER_HOUR_TO_METRE_PER_SEC = 4.4704D-1 // ISO 31-1:1992, 1-10.A.b Long_Float Constant MILE_TO_METRE = 1.609344D3 // ISO 31-1, 1-3.A.d Long_Float Constant MINUTE_ARC_TO_DEGREE_ARC = 1/60 // ISO 31-0:1992, Table 4 Long_Float Constant MINUTE_ARC_TO_RADIAN = PI/10800 // ISO 31-0:1992, Table 4 Long_Float Constant MINUTE_TO_SECOND = 6.0D1 // ISO 31-0:1992, Table 4 Long_Float Constant MOLE_PER_LITRE_TO_MOLE_PER_CUBIC_M = 1.0D3 // ISO 31-8:1992, 8-13.b Long_Float Constant NAUTICAL_MILE_TO_METRE = 1.852D3 // ISO 31-1:1992, 1-3.a Long_Float Constant NEWTON_PER_SQ_M_TO_PASCAL = 1.0D0 // ISO 31-0:1992, Table 2 Long_Float Constant PARSEC_TO_ASTRONOMICAL_UNIT = 2.062648D5 // ISO 31-1:1992, 1-3.B.c Long_Float Constant PARSEC_TO_METRE = 3.085678D16 // ISO 31-1:1992, 1-3.B.c Long_Float Constant PERCENT_TO_UNITLESS = 1.0D-2 // ISO 31-0:1992, 2.3.3 (derived) Long_Float Constant PI = 3.1415926535897932 //Handbook of Chemistry and Physics [HCP]. Long_Float Constant PPB_MASS_FRACTION_TO_KG_PER_KG = 1.0D-9 // ISO 31-0:1992, 2.3.3 (derived) Long_Float Constant PPM_MASS_FRACTION_TO_KG_PER_KG = 1.0D-6 // ISO 31-0:1992, 2.3.3 (derived) Long_Float Constant PPT_MASS_FRACTION_TO_KG_PER_KG = 1.0D-12 // ISO 31-0:1992, 2.3.3 (derived) Long_Float Constant PPTH_MASS_FRACTION_TO_KG_PER_KG = 1.0D-3 // ISO 31-0:1992, 2.3.3 (derived) Long_Float Constant RAD_TO_GRAY = 1.0D-2 // ISO 31-10:1992, 10-51.a Long_Float Constant REM_TO_SIEVERT = 1.0D-2 // ISO 31-10:1992, 10-52.a Long_Float Constant RONTGEN_TO_COULOMB_PER_KG = 2.58D4 // ISO 31-10:1992, 10-58.a Long_Float Constant SECOND_ARC_TO_DEGREE_ARC = 1/3600 // ISO 31-0:1992, Table 4 Long_Float Constant SECOND_ARC_TO_RADIAN = PI/648000 // ISO 31-0:1992, Table 4 Long_Float Constant SECOND_PER_CUBIC_M_RADIAN_TO_SECOND_PER_CUBIC_METRE = 1.0D0 // ISO 31-0:1992, 2.3.3 (derived) Long_Float Constant TEC_TO_INV_SQ_METRE = 1.0D16 Long_Float Constant TON_TO_KILOGRAM = 9.071847D2 // ISO 31-3:1992, 3-1.B.e Long_Float Constant TONNE_PER_CUBIC_METRE_TO_KG_PER_CUBIC_METRE = 1.0D3 // ISO 31-3:1992, 3-2.b Long_Float Constant TONNE_TO_KILOGRAM = 1.0D3 // ISO 31-0:1992, Table 4 Long_Float Constant UNIFIED_AMASS_UNIT_TO_KILOGRAM = 1.660540D-27 // ISO 31-0:1992, Table 6 Long_Float Constant WATT_HOUR_TO_JOULE = 3.6D3 // ISO 31-5:1992, 5-52.b (derived) Long_Float Constant WATT_PER_SQ_CM_SEC_TO_WATT_PER_SQ_METRE_SEC = 1.0D-4 // ISO 31-0:1992, 2.3.2.3 (derived) Long_Float Constant WATT_SECOND_TO_JOULE = 1.0D0 // ISO 31-0:1992, Table 2 Long_Float Constant YEAR_TO_DAY = 3.6524220D2 // ISO 31-1:1992, 1-7.B.a Long_Float Constant YEAR_TO_SECOND = 3.1556926D7 // ISO 31-1:1992, 1-7.B.a
//Conversion factors for EDCS Unit Scales Long_Float Constant YOTTA_TO_ONE = 1.0D24 // ISO 31-0:1992, Table 4 Long_Float Constant ZETTA_TO_ONE = 1.0D21 // ISO 31-0:1992, Table 4 Long_Float Constant EXA_TO_ONE = 1.0D18 // ISO 31-0:1992, Table 4 Long_Float Constant PETA_TO_ONE = 1.0D15 // ISO 31-0:1992, Table 4 Long_Float Constant TERA_TO_ONE = 1.0D12 // ISO 31-0:1992, Table 4 Long_Float Constant GIGA_TO_ONE = 1.0D9 // ISO 31-0:1992, Table 4 Long_Float Constant MEGA_TO_ONE = 1.0D4 // ISO 31-0:1992, Table 4 Long_Float Constant KILO_TO_ONE = 1.0D3 // ISO 31-0:1992, Table 4 Long_Float Constant HECTO_TO_ONE = 1.0D2 // ISO 31-0:1992, Table 4 Long_Float Constant DECA_TO_ONE = 1.0D1 // ISO 31-0:1992, Table 4 Long_Float Constant ONE_TO_ONE = 1.0 // ISO 31-0:1992, Table 4 Long_Float Constant DECI_TO_ONE = 1.0D-1 // ISO 31-0:1992, Table 4 Long_Float Constant CENTI_TO_ONE = 1.0D-2 // ISO 31-0:1992, Table 4 Long_Float Constant MILLI_TO_ONE = 1.0D-3 // ISO 31-0:1992, Table 4 Long_Float Constant MICRO_TO_ONE = 1.0D-6 // ISO 31-0:1992, Table 4 Long_Float Constant NANO_TO_ONE = 1.0D-9 // ISO 31-0:1992, Table 4 Long_Float Constant PICO_TO_ONE = 1.0D-12 // ISO 31-0:1992, Table 4 Long_Float Constant FEMTO_TO_ONE = 1.0D-15 // ISO 31-0:1992, Table 4 Long_Float Constant ATTO_TO_ONE = 1.0D-18 // ISO 31-0:1992, Table 4 Long_Float Constant ZEPTO_TO_ONE = 1.0D-21 // ISO 31-0:1992, Table 4 Long_Float Constant YOCTO_TO_ONE = 1.0D-24 // ISO 31-0:1992, Table 4 Long_Float Constant KIBI_TO_ONE = 1024 // IEC 60027-2:2000 Long_Float Constant MEBI_TO_ONE = 1048576 // IEC 60027-2:2000 Long_Float Constant GIBI_TO_ONE = 1073741824 // IEC 60027-2:2000 Long_Float Constant TEBI_TO_ONE = 1099511627776 // IEC 60027-2:2000 Long_Float Constant PEBI_TO_ONE = 1125899906842624 // IEC 60027-2:2000 Long_Float Constant EXBI_TO_ONE = 1152921504606846976 // IEC 60027-2:2000
The EDCS Unit Conversion Application Program Interface contains the single function defined in Table 9.3:
Table 9.3 -- Convert_Quantity_Value
| Property | Description | |
| Semantics | This function converts an input value of a quantity with a given EUC and ESC, into an output value of a quantity with a given EUC and ESC. | |
| Input parameters | Parameter_name | Parameter_Data_Type |
input_value |
Unit_Value |
|
| Output parameters | Parameter_name | Parameter_Data_Type |
output_value |
Unit_Value |
|
status |
Status_Code |
|
![]()