Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Releases Libraries [Library] matheval

 
  • 0 Vote(s) - 0 Average
Library matheval
SyS
Offline

Burgershot Member
Posts: 37
Threads: 5
Joined: Apr 2019
Reputation: 4
#1
2019-04-14, 07:19 AM (This post was last modified: 2019-04-15, 03:52 AM by Kar.)
matheval

[Image: matheval.svg?branch=master] [Image: matheval.svg] [Image: matheval.svg] [Image: matheval.svg]

This is a simple library for evaluating mathematical expressions given as string literals.Currently supported operators are:
  • + - addition 
  • - - subtraction 
  • ^ - exponential 
  • / - division 
  • * - product
If you have any issues or improvements to be made in this code just open an issue or pull request

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
returns
  • NaN if failed
  • if success,value in floating point

For example :


PHP Code:
#include<matheval>
main(){
   printf("(1+3)^(32/3)-1 = %f",MathEval("(1+3)^(32/3)-1"));
} 

Testing

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

Repository
https://github.com/Sreyas-Sreelal/matheval
Atom
Offline

Burgershot Member
Posts: 74
Threads: 6
Joined: Apr 2019
Reputation: 13
#2
2019-04-14, 07:22 AM
good job
Contact
VK: https://vk.com/id592539261
Email: [email protected]
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode