calculation to external function