Promotic
Login logon

Trunc - method of the Pm object

Description:
Returns the integer part of a number (removes any fractional digits).
Syntax:
Double Trunc(Double nValue)
Parameters:
nValue(Double) A number.
If the value is of type String, then it is converted to a number.
Note:
This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels.

This method works the same way as the Pm.Floor method for positive numbers and as the Pm.Ceil method for negative numbers.
Example:
JavaScriptVBScriptSelect and copy to clipboard

var n;
n = Pm.Trunc(3.14);   // Returns 3
n = Pm.Trunc(-3.14);   // Returns -3
n = Pm.Trunc(0.04);   // Returns 0
n = Pm.Trunc(-0.04);   // Returns 0
n = Pm.Trunc(7);   // Returns 7
n = Pm.Trunc(-7);   // Returns -7

History:
Pm8.03.26: Created
PROMOTIC 9.0.34 SCADA system documentation MICROSYS, spol. s r.o.

Send page remark Contact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
- Trunc
 
 
© MICROSYS, spol. s r.o.Update cookies preferences