| 
															
																@@ -1,4 +1,3 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import { StoreObject } from '../store/storeObject'; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import * as Commands from './../../ast/commands'; 
															 | 
															
															 | 
															
																 import * as Commands from './../../ast/commands'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import { Types } from './../../typeSystem/types'; 
															 | 
															
															 | 
															
																 import { Types } from './../../typeSystem/types'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import { toReal } from "./../../typeSystem/parsers"; 
															 | 
															
															 | 
															
																 import { toReal } from "./../../typeSystem/parsers"; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -6,7 +5,7 @@ import { Decimal } from 'decimal.js'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import { MultiType } from '../../typeSystem/multiType'; 
															 | 
															
															 | 
															
																 import { MultiType } from '../../typeSystem/multiType'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import { ArrayType } from '../../typeSystem/array_type'; 
															 | 
															
															 | 
															
																 import { ArrayType } from '../../typeSystem/array_type'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import { Modes } from '../modes'; 
															 | 
															
															 | 
															
																 import { Modes } from '../modes'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import { Config } from '../../util/config'; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import { StoreValue } from '../store/value/store_value'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 /** 
															 | 
															
															 | 
															
																 /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  * sin 
															 | 
															
															 | 
															
																  * sin 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -29,7 +28,7 @@ function convertToRadians (degrees) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createSinFun () { 
															 | 
															
															 | 
															
																 export function createSinFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    const sinFun = (sto, _) => { 
															 | 
															
															 | 
															
																    const sinFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																      const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-     const angle = x.value.mod(360); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     const angle = x.get().mod(360); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      let result = null; 
															 | 
															
															 | 
															
																      let result = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      if(angle.eq(90)) { 
															 | 
															
															 | 
															
																      if(angle.eq(90)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        result = new Decimal(1); 
															 | 
															
															 | 
															
																        result = new Decimal(1); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -40,12 +39,10 @@ export function createSinFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      } else { 
															 | 
															
															 | 
															
																      } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        result = Decimal.sin(convertToRadians(angle)); 
															 | 
															
															 | 
															
																        result = Decimal.sin(convertToRadians(angle)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      } 
															 | 
															
															 | 
															
																      } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //  if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-     const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																      sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-     return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    }; 
															 | 
															
															 | 
															
																    }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const block = new Commands.CommandBlock([],  [new Commands.SysCall(sinFun)]); 
															 | 
															
															 | 
															
																   const block = new Commands.CommandBlock([],  [new Commands.SysCall(sinFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -58,7 +55,7 @@ export function createSinFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createCosFun () { 
															 | 
															
															 | 
															
																 export function createCosFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const cosFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const cosFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const angle = x.value.mod(360); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const angle = x.get().mod(360); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let result = null; 
															 | 
															
															 | 
															
																     let result = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if(angle.eq(90)) { 
															 | 
															
															 | 
															
																     if(angle.eq(90)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       result = new Decimal(0); 
															 | 
															
															 | 
															
																       result = new Decimal(0); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -68,12 +65,10 @@ export function createCosFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       result = new Decimal(0) 
															 | 
															
															 | 
															
																       result = new Decimal(0) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     result = Decimal.cos(convertToRadians(angle)); 
															 | 
															
															 | 
															
																     result = Decimal.cos(convertToRadians(angle)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(cosFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(cosFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -86,17 +81,16 @@ export function createCosFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createTanFun () { 
															 | 
															
															 | 
															
																 export function createTanFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const tanFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const tanFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const angle = x.value.mod(360); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const angle = x.get().mod(360); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if(angle.eq(90) || angle.eq(270)) { 
															 | 
															
															 | 
															
																     if(angle.eq(90) || angle.eq(270)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      return Promise.reject("Tangent of "+x.value.toNumber()+"° is undefined."); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      // TODO better error message 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      return Promise.reject("Tangent of "+x.get().toNumber()+"° is undefined."); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let result = Decimal.tan(convertToRadians(angle)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = Decimal.tan(convertToRadians(angle)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(tanFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(tanFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -109,13 +103,11 @@ export function createTanFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createSqrtFun () { 
															 | 
															
															 | 
															
																 export function createSqrtFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const sqrtFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const sqrtFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let result = x.value.sqrt(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = x.get().sqrt(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(sqrtFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(sqrtFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -129,13 +121,11 @@ export function createPowFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const powFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const powFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const y = sto.applyStore('y'); 
															 | 
															
															 | 
															
																     const y = sto.applyStore('y'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let result = x.value.pow(y.value); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = x.get().pow(y.get()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(powFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(powFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -149,16 +139,15 @@ export function createPowFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createLogFun () { 
															 | 
															
															 | 
															
																 export function createLogFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const logFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const logFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    if (x.value.isNegative()) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    if (x.get().isNegative()) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      // TODO better error message 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       return Promise.reject(new Error("the value passed to log function cannot be negative")); 
															 | 
															
															 | 
															
																       return Promise.reject(new Error("the value passed to log function cannot be negative")); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let result = Decimal.log10(x.value); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = Decimal.log10(x.get()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(logFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(logFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -171,9 +160,9 @@ export function createLogFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createAbsFun () { 
															 | 
															
															 | 
															
																 export function createAbsFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const absFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const absFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const result = x.value.abs(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(x.type, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    sto.updateStore('$', temp) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = x.get().abs(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(x.type, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     return Promise.resolve(sto); 
															 | 
															
															 | 
															
																     return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -188,10 +177,11 @@ export function createAbsFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createNegateFun () { 
															 | 
															
															 | 
															
																 export function createNegateFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const negateFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const negateFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const result = x.value.negated(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(x.type, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = x.get().negated(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(x.type, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(negateFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(negateFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -204,13 +194,11 @@ export function createNegateFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createInvertFun () { 
															 | 
															
															 | 
															
																 export function createInvertFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const invertFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const invertFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let result = toReal(1).dividedBy(x.value); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // if(result.dp() > Config.decimalPlaces) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    //   result = new Decimal(result.toFixed(Config.decimalPlaces)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    // } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(Types.REAL, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const result = toReal(1).dividedBy(x.get()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(invertFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(invertFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -223,11 +211,12 @@ export function createInvertFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createMaxFun () { 
															 | 
															
															 | 
															
																 export function createMaxFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const maxFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const maxFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const numbers = x.value.map(stoObj => stoObj.value); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const numbers = x.get().map(sto_addrs => sto_addrs.get()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const result = Decimal.max(...numbers); 
															 | 
															
															 | 
															
																     const result = Decimal.max(...numbers); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(x.type.innerType, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(x.type.innerType, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const paramType = new ArrayType(new MultiType([Types.INTEGER, Types.REAL]), 1); 
															 | 
															
															 | 
															
																  const paramType = new ArrayType(new MultiType([Types.INTEGER, Types.REAL]), 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(maxFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(maxFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -240,11 +229,12 @@ export function createMaxFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createMinFun () { 
															 | 
															
															 | 
															
																 export function createMinFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const minFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const minFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
															
															 | 
															
																     const x = sto.applyStore('x'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const numbers = x.value.map(stoObj => stoObj.value); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const numbers = x.get().map(sto_addrs => sto_addrs.get()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const result = Decimal.min(...numbers); 
															 | 
															
															 | 
															
																     const result = Decimal.min(...numbers); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const temp = new StoreObject(x.type.innerType, result); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(x.type.innerType, result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore('$', temp)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const paramType = new ArrayType(new MultiType([Types.INTEGER, Types.REAL]), 1); 
															 | 
															
															 | 
															
																  const paramType = new ArrayType(new MultiType([Types.INTEGER, Types.REAL]), 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(minFun)]); 
															 | 
															
															 | 
															
																  const block = new Commands.CommandBlock([],  [new Commands.SysCall(minFun)]); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -257,9 +247,10 @@ export function createMinFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 export function createRandFun () { 
															 | 
															
															 | 
															
																 export function createRandFun () { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const randFun = (sto, _) => { 
															 | 
															
															 | 
															
																   const randFun = (sto, _) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const val = Math.random(); 
															 | 
															
															 | 
															
																     const val = Math.random(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    const result = new StoreObject(Types.REAL, new Decimal(val)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    const temp = new StoreValue(Types.REAL, new Decimal(val)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    sto.insertStore("$", temp); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
															
															 | 
															
																     sto.mode = Modes.RETURN; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    return Promise.resolve(sto.updateStore("$", result)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    return Promise.resolve(sto); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }; 
															 | 
															
															 | 
															
																   }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const block = new Commands.CommandBlock([],  [new Commands.SysCall(randFun)]); 
															 | 
															
															 | 
															
																   const block = new Commands.CommandBlock([],  [new Commands.SysCall(randFun)]); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   const func = new Commands.Function('$rand', Types.REAL, [], block); 
															 | 
															
															 | 
															
																   const func = new Commands.Function('$rand', Types.REAL, [], block); 
															 |