Here is an example of performing math functions in Netlinx code.
This is a working calculator module that you can add to your program. Included are a touch panel file with a calculator popup page, and the open source code. The functions are being done in a module, so you can define a module for each touch panel you have. See the calculator main file for an example of how to implement the module into your code.
697-DL1-CALCULATOR.zip provided as example code for you to look at and have fun with.