:Revision=3
:html
<<
128.130
Math-Object|Math
--
The IP-Object Math provides trigonometric and other mathematic functions.
>>
<<
128.130.1
Functions of the Math-Object|Functions
--
>>
<<
128.130.1.1
Math.Sin|Sin
--
<!DEF>
function <!TW>Math.Sin (rOP1 : real) : real;
<!TXT>
Calculates the sinus of <!PW>rOP1.

 <!PW>rOP1 is specified in radians.
>>
<<
128.130.1.2
Math.Cos|Cos
--
<!DEF>
function <!TW>Math.Cos (rOP1 : real) : real;
<!TXT>
Calculates the cosinus of <!PW>rOP1.

 <!PW>rOP1 is specified in radians.
>>
<<
128.130.1.3
Math.Tan|Tan
--
<!DEF>
function <!TW>Math.Tan (rOP1 : real) : real;
<!TXT>
Calculates the tangent of <!PW>rOP1.

 <!PW>rOP1 is specified in radians.

<!CODE>
Result := Sin(rOP1) / Cos(rOP1)
<!TXT>
>>
<<
128.130.1.4
Math.CoTan|CoTan
--
<!DEF>
function <!TW>Math.CoTan (rOP1 : real) : real;
<!TXT>
Calculates the cotangent of <!PW>rOP1.

 <!PW>rOP1 is specified in radians.

<!CODE>
Result := 1 / Tan(rOP1)
<!TXT>
>>
<<
128.130.1.5
Math.ArcSin|ArcSin
--
<!DEF>
function <!TW>Math.ArcSin (rOP1 : real) : real;
<!TXT>
Calculates the inverse sinus of <!PW>rOP1.

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!SW>-1 &lt;= <!PW>rOP1 &lt;= 1<!>
<!ETBL>

The return value is specified in radians and is in the range <b>[-Pi/2..Pi/2]</b>.
>>
<<
128.130.1.6
Math.ArcCos|ArcCos
--
<!DEF>
function <!TW>Math.ArcCos (rOP1 : real) : real;
<!TXT>
Calculates the inverse cosinus of <!PW>rOP1.

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!SW>-1 &lt;= <!PW>rOP1 &lt;= 1<!>
<!ETBL>

The return value is specified in radians and is in the range <b>[0..Pi]</b>.
>>
<<
128.130.1.7
Math.ArcTan|ArcTan
--
<!DEF>
function <!TW>Math.ArcTan (rOP1 : real) : real;
<!TXT>
Calculates the arc tangent of <!PW>rOP1.

The return value is specified in radians.
>>
<<
128.130.1.8
Math.Log10|Log10
--
<!DEF>
function <!TW>Math.Log10 (rOP1 : real) : real;
<!TXT>
Calculates the decade logarithm of <!PW>rOP1.

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!PW>rOP1 &gt; 0<!>
<!ETBL>
>>
<<
128.130.1.9
Math.Log2|Log2
--
<!DEF>
function <!TW>Math.Log2 (rOP1 : real) : real;
<!TXT>
Calculates the logarithm of <!PW>rOP1 in basis 2.

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!PW>rOP1 &gt; 0<!>
<!ETBL>
>>
<<
128.130.1.10
Math.Log|Log
--
<!DEF>
function <!TW>Math.Log (rOP1 : real) : real;
<!TXT>
Calculates the natural logarithm of <!PW>rOP1 (in basis e).

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!PW>rOP1 &gt; 0<!>
<!ETBL>

<!DEF>
function <!TW>Math.Log (rOP1, rBase : real) : real;
<!TXT>
Calculates the logarithm of <!PW>rOP1 in the <!PW>rBase basis.

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!PW>rOP1 &gt; 0<!>
<!c><!PW>rBase &gt; 0<!>
<!ETBL>
>>
<<
128.130.1.11
Math.Sqr|Sqr
--
<!DEF>
function <!TW>Math.Sqr (rOP1 : real) : real;
<!TXT>
Calculates the square of <!PW>rOP1.
>>
<<
128.130.1.12
Math.Power|Power
--
<!DEF>
function <!TW>Math.Power (rBase, rExponent : real) : real;
<!TXT>
Calculates the <!PW>rExponent-th power of <!PW>rBase.

<!CODE>
Result := rBase<sup>rExponent</sup>
<!TXT>
>>
<<
128.130.1.13
Math.Sqrt|Sqrt
--
<!DEF>
function <!TW>Math.Sqrt (rOP1 : real) : real;
<!TXT>
Calculates the square root of <!PW>rOP1.

<!STBL>
<tr bgcolor=f0f0f0><td>value range<!>
<!c><!PW>rOP1 &gt;= 0<!>
<!ETBL>
>>
<<
128.130.1.14
Math.Root|Root
--
<!DEF>
function <!TW>Math.Root (rOP1, rBase : real) : real;
<!TXT>
Calculates the <!PW>rBase radical of <!PW>rOP1.

<!CODE>
Result := rOP1<sup>1/rBase</sup>
<!TXT>
>>
<<
128.130.1.15
Math.BcdToDecimal|BcdToDecimal
--
<!DEF>
function <!TW>Math.BcdToDecimal (rOP1 : real) : real;
<!TXT>
Considers <!PW>rOP1 to be a BCD-value and calculates the decimal equivalent.

The result is in the range [0 .. 99]

<!STBL>
<tr><td bgcolor=f0f0f0>value range<!>
<!c>0 &lt;= <!PW>rOP1 &lt;= 153  resp.<br>
$00 &lt;= <!PW>rOP1 &lt;= $99<!>
<!ETBL>
>>
<<
128.130.1.16
Math.DecimalToBcd|DecimalToBcd
--
<!DEF>
function <!TW>Math.DecimalToBcd (rOP1 : real) : real;
<!TXT>
Converts <!PW>rOP1 from a decimal number into a BCD-value.

The result is in the range [0..153] resp. [$00 .. $99]

<!STBL>
<tr><td bgcolor=f0f0f0>value range<!>
<!c>0 &lt;= <!PW>rOP1 &lt;= 99<!>
<!ETBL>
>>
<<
128.130.1.17
Math.DegToRad|DegToRad
--
<!DEF>
function <!TW>Math.DegToRad (rOP1 : real) : real;
<!TXT>
Converts an angle from degree into radian.

<!CODE>
Result := rOP1 * Pi / 180
<!TXT>
>>
<<
128.130.1.18
Math.RadToDeg|RadToDeg
--
<!DEF>
function <!TW>Math.RadToDeg (rOP1 : real) : real;
<!TXT>
Converts the specified angle <!PW>rOP1 from radian (Rad) into degree.

<!CODE>
Result := rOP1 / Pi * 180
<!TXT>
>>
<<
128.130.1.19
Math.Min|Min
--
<!DEF>
function <!TW>Math.Min (rOP1, rOP2 : real) : real;
<!TXT>
Compares the two values and returns the lower value.
>>
<<
128.130.1.20
Math.Max|Max
--
<!DEF>
function <!TW>Math.Max (rOP1, rOP2 : real) : real;
<!TXT>
Compares the two values and returns the higher value.
>>
<<
128.130.1.21
Math.MaxValue|MaxValue
--
<!DEF>
function <!TW>Math.MaxValue (vVector : vector) : real;
<!TXT>
Returns the highest value in the vector.
>>
<<
128.130.1.22
Math.MirValue|MirValue
--
<!DEF>
function <!TW>Math.MirValue (vVector : vector) : real;
<!TXT>
Returns the lowest value in the vector.
>>
<<
128.130.1.23
Math.Random|Random
--
<!DEF>
function <!TW>Math.Random;
<!TXT>
Returns a random value in the range <b>[0 .. 1[ </b>.

<!DEF>
function <!TW>Math.Random (rRange : real) : real;
<!TXT>
Returns an random integer value in the range <b>[0 .. </b><!PW>rRange<b>[</b>.
>>

<<
128.130.1.24
Math.FloatToBin|FloatToBin
!128.130.1.25
--
<!DEF>
function <!TW>Math.FloatToBin (rFloatType, rValue : real [; rRevert : real]) : vector;
<!TXT>
Returns the processor-internal binary representation of the <!PW>rValue - i.e. of the bytes which form the <!PW>rValue in the computer.

 <!PW>rFloatType selects the data type used for the conversion:
<!STBL>
<!+>rFloatType<!+>Name<!+>Size<!>
<!c>1<!>Real48<!r>6 Byte<!>
<!c>2<!>Single<!r>4 Byte<!>
<!c>3<!>Double<!r>8 Byte<!>
<!c>4<!>Extended<!r>10 Byte<!>
<!c>5<!>Comp<!r>8 Byte<!>
<!c>6<!>Byte<sup>**</sup><!r>1 Byte<!>
<!c>7<!>Word<sup>**</sup><!r>2 Byte<!>
<!c>8<!>DWord<sup>**</sup><!r>4 Byte<!>
<!c>9<!>PicFloat<sup>***</sup><!r>4 Byte<!>
<!ETBL>

<!REM>
 <sup>*</sup>Type 1 corresponds to the Borland Float-Typ &quot;Real&quot; in Pascal, resp. &quot;Real48&quot; in Delphi.
 <sup>**</sup>For these types, the fractional part (digits after the decimal separator) is lost
 <sup>***</sup>Type 9 is the data format used in SerIO modules
<!TXT>

If <!PW>rRevert is specified and <!RW>TRUE, the generated byte sequence will be MSB first, otherwise (default) LSB first.
Type 9 has a reversed ordering of the bits (in respect to all the other types). This means: <!PW>rRevert <!RW>TRUE results in LSB first, otherwise (default) MSB first.
>>

<<
128.130.1.25
Math.BinToFloat|BinToFloat
!128.130.1.24
--
<!DEF>
function <!TW>Math.BinToFloat (rFloatType : real; vByteVect : vector [; rRevert : real]) : real;
<!TXT>
Takes the bytes in vector <!PW>vByteVect as binary representation of a float value and sends this value back. The byte vector must contain exactly as many bytes as necessary for the types selected by the <!PW>rFloatType.

 <!PW>rFloatType selects the data type used for the conversion:
<!STBL>
<!+>rFloatType<!+>Name<!+>Size<!>
<!c>1<!>Real48<!r>6 Byte<!>
<!c>2<!>Single<!r>4 Byte<!>
<!c>3<!>Double<!r>8 Byte<!>
<!c>4<!>Extended<!r>10 Byte<!>
<!c>5<!>Comp<!r>8 Byte<!>
<!c>6<!>Byte<!r>1 Byte<!>
<!c>7<!>Word<!r>2 Byte<!>
<!c>8<!>DWord<!r>4 Byte<!>
<!c>9<!>PicFloat<sup>**</sup><!r>4 Byte<!>
<!ETBL>

<!REM>
 <sup>*</sup>Type 1 corresponds to the Borland Float-Typ &quot;Real&quot; in Pascal, resp. &quot;Real48&quot; in Delphi.
 <sup>***</sup>Type 9 is the data format used in SerIO modules
<!TXT>

If <!PW>rRevert is specified and <!RW>TRUE, the given byte sequence will be treated as MSB first, otherwise (default) LSB first.
Type 9 has a reversed ordering of the bits (in respect to all the other types). This means: <!PW>rRevert <!RW>TRUE  LSB first, otherwise (default) MSB first.
>>

<<
128.130.2
Procedures of the Math-Object|Procedures
--
>>
<<
128.130.2.1
Math.Randomize|Randomize
--
<!DEF>
procedure <!TW>Math.Randomize;
<!TXT>
Sets the output value of the random number generator on a quasi-random output value. For this purpose the High-Performance Counter of the PC is used (similar to the system time).

This command can be used once (and once is enough!), if the random numbers should not be reproducible.

<!DEF>
procedure <!TW>Math.Randomize (rRandSeed : real);
<!TXT>
Sets the <!PW>rRandSeed value as start value of the random number generator.
For the same value of the <!PW>rRandSeed, the random number sequence generated is always identical. For static algorithm analysis or tests reproducible random number sequences may be generated this way.
>>
