Download (UCL) Reference Manual
Transcript
Dok.-Nr/Doc. No.: CGS–RIBRE–STD–0001 Ausgabe/Issue: Überarbtg./Rev.: Seite/Page: 5 – 4–57 Datum/Date : 2009–02–01 Datum/Date: 2010–01–29 von/of 4–96 Non–Unitized Type to Unitized Type Conversion unitized_type unitized_type unitized_type unitized_type (real_value) (long_real_value) (integer_value) (unsigend_integer_value) The result of type conversion is the unitless value expressed in units of unitized_type. A conversion between real and integer values is done, if necessary. Examples: type Velocity = REAL [m/s]; type Distance = INTEGER [km]; type Dozen = REAL [doz]; ... Velocity (3.6) Distance (3.6) Dozen (24.0) –– returns 3.6 [m/s] –– returns 3 [km] –– returns 2.0 [doz] Unitized Type to Unitized Type Conversion unitized_type (unitized_value) The type of unitized_value must be commensurable with unitized_type. The result of this type conversion is the value of unitized_value expressed in units of unitized_type. A conversion between real and integer values is done, if necessary. Example: unit [mph] = [1609 m/h]; type Mph –– miles per hour = REAL [mph]; variable Speed : REAL [m/s]; variable X : REAL; ... X := REAL (Mph (Speed)); –– Speed is converted to Mph, then to REAL INTEGER/UNSIGNED_INTEGER Conversion INTEGER (unsigned_integer_value) UNSIGNED_INTEGER (integer_value) These conversions are implicitly carried out whenever necessary. They may, however, also be done explicitly. A check will be done that the allowed range of the target type is not violated. Examples: Unsigned_Integer_Value := UNSIGNED_INTEGER (Integer_Value) * 2; REAL/LONG_REAL Conversion REAL (long_real_value) LONG_REAL (real_value) These conversions are implicitly carried out whenever necessary. They may, however, also be done explicitly. Examples: Long_Real_Value := LONG_REAL (Real_Value) * 1.0E50; Daimler–Benz Aerospace AG, D–28199 Bremen – All Rights reserved – Copyright per DIN 34