pjs.math
This API is a tag function that is used to evaluate a math expression specified as a tagged template literal. Math expression evaluation is performed by the mathjs library. Math evaluation supports precise decimal values, and arithmetic results are returned as precise decimal. See the mathjs documentation for syntax.
This API is typically used in applications that have been transformed from RPG code. Profound Logic’s RPG to JavaScript converter uses this API to assist in transformation of math expressions involving large decimal values.
Parameters
Math expression string: A template literal string containing a math expression and optional placeholder values.
Example
pjs.define("num1", { type: "packed", length: 19, decimals: 4, precise: true, initValue: "222222222222222.3333" });
pjs.define("num2", { type: "packed", length: 19, decimals: 4, precise: true, initValue: "444444444444444.2222" });
pjs.define("result", { type: "packed", length: 19, decimals: 4, precise: true });
result = pjs.math`${num1} + ${num2}`;
console.log(String(result)); // Output: 666666666666666.5555
Â
Some documentation pages have recently moved to a new section: Profound AppDev. If you are having trouble finding specific pages, try the documentation search capability or reach out to our Support team!