Skip to content

alpertron/calculators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I have written 14 calculators in my free time. Their source code is open source, so you can use the code for your own projects.

I started writing these calculators as Java applets in 1997. In 2015 I ported them to C language. The code is compiled to WebAssembly or asm.js using Emscripten so it can run inside Web browsers.

The complete source code size is about 70 000 lines of code.

Running the programs as standalone executables

The main purpose of compiling the code is to run coverage tests. The file coverage.out.old holds the results of running all calculators with different inputs. After making a change in the code, I run this test again and the output should not be changed. When adding a new feature to the calculators, I add the new case to the coverage, and change the results file if the results are correct. These tests use the files Makefile and coverage.

You can use Makefile to generate standalone executables. Just run make clean and then make. If you want to build only one of the calculators, you can run make calculator, where calculator is one of the following words:

After building the calculators, you can run them. For example:

./polfact 0 "x^2+x+3" 2

The output is in HTML and it starts with a digit (this is used by the JavaScript code). All calculators can process expressions.

If you run the calculator without command line parameters, the program will show the expected arguments.

Static code analysis

Software quality assurance is realized with the coverage test explained in the previous section and static analysis. The latter is done by tools that scan the source code. The programs do not run in this case.

Results of static analysis and code coverage of this software using Codacy.

Badges from SonarCloud:

Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

If you like these calculators and you want to support free software, you can donate via Paypal by clicking in the button below:

paypal