Loading...
 

CX_NUMERIC - Real number

CX_NUMERIC

Class hierarchy
Description:

This class is used to represent real numbers with a maximum of 16 places before the decimal point and 8 places after.

Instantiation

To create an object of this class with InstantView® , the following possibilities exist:

  • Create with the command CreateTransObject(CX_NUMERIC) or CreatePersObject(CX_NUMERIC)
  • Direct placement of a real number on the stack similar to integer numbers. The part before the decimal point must be terminated with a ".", so that a real, and not an integer, number is generated. The precision, i.e. the number of decimal places, is also determined. For example, the only difference between "2.1" and "2.100" is that the first number has an accuracy of "1" and the second has an accuracy of "3". The specification "2." produces the real number "2" with an accuracy of "0". If the number of decimal places exceeds the permissible value of "8", only the first 8 are taken into account and work with this accuracy. Negative numbers must be written in round brackets, for example (-2,100).

Attention: The precision for a CX_NUMERIC is implicitly defined when it is created and is then retained for this object. If the CX_NUMERIC is created as a literal (0.000), then the number of specified decimal places determines the precision. If a CX_NUMERIC is created by CreateTransObject/CreatePersObject, then the precision is set to 2 decimal places.

If a new value is assigned via Put, then the type of the operand controls which precision is taken over:

Code example:

Var(num1, num2)
CreateTransObject(CX_NUMERIC) -> num1    // CX_NUMERIC erzeugen
25.5 -> num1                             // und Wert zuweisen
.................
55.4 -> num2
................
num1 num2 +=     // Ergebnis :    num1 = 80,9

Display on screen

InstantView® Instruction: Numeric

In connection with this interface object and certain InstantView® instructions, the flags belonging to the object play an important role, as they can be used to modify the representation of the object.

Operators
Operator Brief description
+, -, *, / Arithmetic
+=, -=, *=, /= Arithmetic with assignment semantics
>, <, = Compare
List of methods (MDI)
Function MA* Parameters Return Brief description
abs OBJECT Unsigned value
AdjustPrecision Adjusting the accuracy, no object back
Amount OBJECT Return of the object value
arc OBJECT radian measure
arccos OBJECT Arcus Cosine
arcsin OBJECT Arc Sine
arctan OBJECT Arcus tangent
ceil OBJECT Smallest integer greater than object
ChangeSign Reverse sign
cos OBJECT Cosine
cosh OBJECT Cosine hyperbolicus
cot OBJECT Cotangent
DiscreteRange (OBJECT, OBJECT, OBJECT) INTEGER Test the dental area
exp OBJECT Exponent
floor OBJECT Largest integer smaller than object
GetFraction OBJECT Number in fractional form
GetNumeric OBJECT Return: Object as a real number
GetValue OBJECT Return: Object as a unitless value
GrossAmount (OBJECT) OBJECT Add up percentage value
InWords (INTEGER, INTEGER) MLSTRING Convert number into number words
IsInteger INTEGER Test integer
IsNegatives INTEGER Test negative sign
IsZero INTEGER Test number to zero
itoa STRING Return: Number without decimal places as a character string
ln OBJECT natural logarithm
log OBJECT Logarithm. Base 10 (log10 x)
max (OBJECT) OBJECT Comparison "Larger" if (a > b) a else b
min (OBJECT) OBJECT Comparison "Smaller" if (a < b) a else b
NetAmount (OBJECT) OBJECT Division with percentage value
PercentDifference (OBJECT) OBJECT Difference of two numbers as a percentage value
pow (OBJECT) OBJECT Calculates number high Parameter number xy
Precision * Changing the accuracy
Reciprocal OBJECT Calculation of reciprocal values
Round (INTEGER) Rounding the number
round (OBJECT) OBJECT like Round, but with return of the object
RoundAutomatically OBJECT Round the number with current precision as number of decimal places
Rounded (INTEGER)
SetNumeric STRING, INTEGER Import string as number
SetPrecision (INTEGER) Set number of decimal places
SetZero Set number to zero
are OBJECT Sine
sinh OBJECT Sinus hyperbolicus
sqrt OBJECT Square Root
tan OBJECT Tangent
tanh OBJECT Tangent hyperbolicus
Truncate (INTEGER) Truncation of decimal places
truncate (OBJECT) OBJECT like Truncate, but with return of the object
Add CX_AMOUNT CX_AMOUNT Operator + as function
AddAssign CX_AMOUNT Operator += as function
AmountWeak CX_AMOUNT Return of the object value, INVALID is returned in case of non-computability
Car format INTEGER, INTEGER CX_AMOUNT Returns an object formatted according to the given number of digits before and after the decimal point (only with CX_VALUE, otherwise the object itself).
DivAssign CX_AMOUNT Operator /= as function
Divide CX_AMOUNT CX_AMOUNT Operator / as function
MulAssign CX_AMOUNT Operator *= as function
Multiply CX_AMOUNT CX_AMOUNT Operator * as function
PrecisionAdjusted OBJECT like AdjustPrecision, but with return of the object
string INTEGER CX_STRING Returns the string representation of the object
SubAssign CX_AMOUNT Operator -= as function
Subtract CX_AMOUNT CX_AMOUNT Operator - as a function

* MA = Member Access Function

Data directory (DDI)
Data field Type Reference class I* Brief description
this CX_NUMERIC The number

* I = Indexable data field

Use in AppsWH
Module Brief description
calcula.mod Unit pocket calculator module