pjs.parseFloat()
Â
Converts the value of an expression to float format.
Parameters
Numeric or Character Expression
Â
Examples
Example 1: Int -> Float
pjs.define("f1", { type: 'float', length: 8 });
Â
f1 = pjs.parseFloat(12345);
Â
return f1;
//1.2345E4
Â
Â
Example 2: Char -> Float
Â
pjs.define("c1", { type: 'char', length: 15, initValue: ' + 5 . 2 ' });
pjs.define("f1", { type: 'float', length: 8 });
fl1 = pjs.parseFloat(c1);
Â
return f1;
// 5.2E0
Â
Example 3: Packed Decimal Expression
Â
pjs.define("p1", { type: 'packed decimal', length: 15, decimals: 0, initValue: 1 });
pjs.define("p2", { type: 'packed decimal', length: 25, decimals: 13, initValue: 3 });
pjs.define("result1", { type: 'packed decimal', length: 15, decimals: 5 });
Â
result1 = pjs.parseFloat(p1 / p2);
return result1;
//0.33333.
Â
RPG EquivalentÂ
%FLOAT()