REAL Object
- Last UpdatedMar 28, 2023
- 5 minute read
The Real Object is a number with integer and decimal (fractional) parts. It also can represent a physical quantity so in addition to a value it can also have units, and the units will be of that physical quantity (or Measure, or dimension). Reals with physical quantity preserve this in all their functions, when used as arguments to other objects, and in arithmetic expressions. The units have to be compatible with the operation being performed (for example trigonometrical functions will expect to operate on ANGLEs. In the following methods comments are made about constraints and expectations regarding the dimensions of the real values.
When a real is created it is normally, (but not always, for example, the convert units functions) created in current working units of the quantity.
Methods
|
Name |
Result |
Purpose |
|---|---|---|
|
Constructors |
||
|
Real(BOOLEAN) |
REAL |
Creates a REAL from the given BOOLEAN: TRUE = 1, FALSE = 0. |
|
Real(BORE) |
REAL |
Creates a REAL from the given BORE. |
|
Real(STRING) |
REAL |
Creates a REAL from the given STRING. The STRING must include a number to give value to the REAL. If the STRING also a unit qualifier appended to the number the REAL is given the dimension of the physical quantity and its value will be converted to current working units of that dimension. It will also interpret an extended range of feet and inch formats. |
|
Real( STRING, FORMAT ) |
REAL |
Creates a REAL from the given STRING in the specified format. If the string contains no unit qualifier the format defines the type of physical quantity and the units of the number. (or current units if format units not set). The resulting REAL has current units regardless of the format or input units. If the conversion fails then the Format object is used to provide alternative unit qualifiers for the dimension (unit of measure) and these are used to try and interpret the value. This is similar to the matching string functions. |
|
Real(REAL, UNIT) |
n/a |
Creates an new REAL with the value of the REAL argument (ignoring its units) in the units of UNIT. |
|
Unit Related Queries |
||
|
Value() |
REAL |
Return undimensioned REAL with same value as original. |
|
Dimension() |
MEASURE |
Dimension (of measure) of the physical quantity recorded by the real. |
|
Unit()Units() |
UNIT |
Unit of measure of the quantity stored in the REAL. |
|
AllDimensions() |
ARRAY of |
Set of all standard dimensions. |
|
AllUnits() |
ARRAY of |
Set of all named, standard Units. |
|
Unit Conversion Methods |
||
|
Cast(UNIT) |
REAL |
Same as REAL(REAL,UNIT). Returns a REAL with the value of the REAL object (ignoring its units) in the units of UNIT. |
|
ConvertUnits(STRING)Convert(UNIT)ConvertUnits(UNIT) |
REAL |
Returns a REAL converted from original units to the units specified by the UNIT or STRING argument. The STRING value must be able to be interpreted as a valid unit. If Object is undimensioned, its value is assumed to be in the DatabaseUnits consistent with the unit specified by the STRING or UNIT argument. |
|
DBUnits() |
REAL |
Returns a real of same physical size, but in database units. |
|
CurrentUnits() |
REAL |
Returns a REAL of the same physical size, whose value is converted to be in current working units and units of current units. |
|
CurrentUnits(STRING) |
REAL |
Returns a REAL of the same dimension as original and whose value reflects the same physical size, but whose value is measured in current units. If the original REAL has units - returns a Real with units of current units. The argument is ignored. If the REAL has no units - the argument used to qualify the units of measure of the REAL. Its units are that of the UNIT or STRING argument. If the argument is a MEASURE of name of a MEASURE then the units are the appropriate database units. The returned REAL is returned only as a converted Value. It has no units or dimension (as had the original REAL). |
|
Arithmetic and Logical Functions |
||
|
ABS() |
REAL |
Absolute value (make value positive). |
|
ACos() |
REAL |
ACOS. The real must be purely numeric. |
|
ALog() |
REAL |
ALOG. The real must be purely numeric. |
|
ASin() |
REAL |
ASIN. The real must be purely numeric. |
|
ATan() |
REAL |
ATAN. The real must be purely numeric. |
|
ATanT(REAL) |
REAL |
ATANT. The real must be purely numeric. |
|
Between(REAL, REAL) |
BOOLEAN |
TRUE if value lies in specified range including values specified. All the REALs must be of the same or compatible physical quantities and will be interpreted in consistent units. |
|
Boolean() |
BOOLEAN |
FALSE if value is zero, otherwise TRUE. |
|
Bore() |
BORE |
Convert to BORE (must be exact) dependent on current BORE units. |
|
Cosine() |
REAL |
COSINE. The REAL must be an angle, or purely numeric. |
|
Distance() |
STRING |
Convert to a distance using default settings. |
|
Distance(BOOLEAN feet, BOOLEAN us, BOOLEAN fraction, REAL precision, BOOLEAN zeroes) |
STRING |
Convert to a distance: to feet and inches if feet (otherwise inches); to US format if us (otherwise AVEVA E3D Design format); use fraction if fraction (otherwise decimals); use precision as largest denominator or precision decimal places; output zeroes if zeroes (otherwise them). |
|
EQ(BORE) |
BOOLEAN |
Comparison dependent on current BORE units. The two reals must be of compatible quantities and are compared in consistent units. |
|
EQ(REAL) |
BOOLEAN |
TRUE if equal. The two REALs must be of compatible quantities and are compared in consistent units. |
|
GEQ(BORE) |
BOOLEAN |
Comparison dependent on current BORE units. The two REALs must be of compatible quantities and are compared in consistent units. |
|
GEQ(REAL) |
BOOLEAN |
TRUE if greater than or equal to another value. The two REALs must be of compatible quantities and are compared in consistent units. |
|
GT(BORE) |
BOOLEAN |
Comparison dependent on current BORE units. The two REALs must be of compatible quantities and are compared in consistent units. |
|
GT(REAL) |
BOOLEAN |
TRUE if greater than another value. The two reals must be of compatible quantities and are compared in consistent units. |
|
INT() |
REAL |
Convert to whole number, rounding down. |
|
LEQ(BORE) |
BOOLEAN |
Comparison dependent on current BORE units. The two REALs must be of compatible quantities and are compared in consistent units. |
|
LEQ(REAL) |
BOOLEAN |
TRUE if less than or equal to another value. The two REALs must be of compatible quantities and are compared in consistent units. |
|
LOG() |
REAL |
LOG. REAL should be numeric. |
|
LT(BORE) |
BOOLEAN |
Comparison dependent on current BORE units. The two REALs must be of compatible quantities and are compared in consistent units. |
|
LT(REAL) |
BOOLEAN |
TRUE if less than another value. The two REALs must be of compatible quantities and are compared in consistent units. |
|
MODULO (REAL) |
REAL |
The remainder MODULO the given REAL. A.MODULO(P) has the value A - floor (A / P) * P, where P cannot be zero. |
|
NearestBore() |
BORE |
Convert to nearest BORE dependent on current BORE units setting. |
|
Nint() |
REAL |
Convert to nearest whole number (up or down). |
|
Power(REAL) |
REAL |
Raise value to power. If the original REAL is of physical quantity the power value should be integer. |
|
Real() |
REAL |
Convert to REAL (in this case a null operation). |
|
SBetween (REAL,REAL) |
BOOLEAN |
TRUE if value lies in specified range excluding values specified. All the reals must be of the same or compatible physical quantities and will be interpreted in consistent units. |
|
Sine() |
REAL |
SINE. The REAL must be an angle, or purely numeric. |
|
Sqrt() |
REAL |
Square root of value. If result is not a supported unit of measure it will error. |
|
String(STRING precision) |
STRING |
Convert to STRING with precision specified as a STRING in the range ‘D0’ to ‘D6’. |
|
String(FORMAT) |
STRING |
Convert to STRING using settings in Global FORMAT object. Same process of using format units and unit qualifiers in the STRING as applied in REAL(STRING, FORMAT). |
|
Tangent() |
REAL |
TANGENT. The REAL must be an angle, or purely numeric. |