pjs.parseFloat()

 

Converts the value of an expression to float format.

Parameters

  1. 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()