22.08.2018, 14:53
This is a simple library for evaluating mathematical expressions given as string literals.Currently supported operators are:
Installation
If you are using sampctl just use
sampctl package install Sreyas-Sreelal/matheval
Otherwise just clone the repository
git clone https://www.github.com/sreyas-sreelal/matheval.git
and add matheval.inc to your pawno/includes folder
Usage
There is only one function
MathEval(expression[])
parameters
For example :
Testing
To run the tests:
sampctl package run
Dependencies
https://github.com/Sreyas-Sreelal/matheval
- + - addition
- - - subtraction
- ^ - exponential
- / - division
- * - product
Installation
If you are using sampctl just use
sampctl package install Sreyas-Sreelal/matheval
Otherwise just clone the repository
git clone https://www.github.com/sreyas-sreelal/matheval.git
and add matheval.inc to your pawno/includes folder
Usage
There is only one function
MathEval(expression[])
parameters
- expression[] - mathmatical expression in string literal
- NaN if failed
- if success,value in floating point
For example :
Код:
#include<matheval> main(){ printf("(1+3)^(32/3)-1 = %f",MathEval("(1+3)^(32/3)-1")); }
To run the tests:
sampctl package run
Dependencies
- SA-MP 0.3.7 by SA-MP team - https://www.sa-mp.com/download.php
- sampctl by SouthClaws (optional but recommended) - https://github.com/Southclaws/sampctl
https://github.com/Sreyas-Sreelal/matheval