SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 29/08/2017, 05:29 PM   #1
Jelly23
Big Clucker
 
Join Date: Aug 2017
Posts: 77
Reputation: 142
Default CMath Library

• CMath Library

I released this plugin well before in Portuguese section before my account removal but didn't do it here until now, this was pretty much my first plugin release back then.

This plugin allows you to use some of CMath library's mathematical functions, few aren't included since they already exist.

Reference: Here

Functions:
Code:
native Float:cosh(Float:x);
native Float:sinh(Float:x);
native Float:tanh(Float:x);
native Float:acosh(Float:x);
native Float:asinh(Float:x);
native Float:atanh(Float:x);
native Float:exp(Float:x);
native Float:frexp(Float:x, &exp);
native Float:ldexp(Float:x, exp);
native Float:log10(Float:x);
native Float:modf(Float:x, &Float:intpart);
native Float:exp2(Float:x);
native Float:expm1(Float:x);
native ilogb(Float:x);
native Float:log1p(Float:x);
native Float:log2(Float:x);
native Float:logb(Float:x);
native Float:scalbn(Float:x, exp);
native Float:cbrt(Float:x);
native Float:hypot(Float:x, Float:y);
native Float:tgamma(Float:x);
native Float:lgamma(Float:x);
native Float:remquo(Float:numer, Float:denom, &quot);
native Float:copysign(Float:x, Float:y);
native Float:fdim(Float:x, Float:y);
native Float:fmax(Float:x, Float:y);
native Float:fmin(Float:x, Float:y);
Examples:
PHP Code:
//Example: native Float:frexp(Float:x, &exp); 

main() 

     new 
Float:param 8.0Float:resultn

     
result frexp (param n); 
     
printf ("%f = %f * 2^%d\n"paramresultn); 


//Output: 8.000000 = 0.500000 * 2^4 
PHP Code:
//Example: native Float:remquo(Float:numer, Float:denom, &quot); 

main() 

      new 
Floatnumer 10.3Float:denom 4.5Float:resultquot
       
      
result remquo (numerdenomquot); 
       
      
printf ("numerator: %f"numer); 
      
printf ("denominator: %f"denom); 
      
printf ("remainder: %f"result); 
      
printf ("quotient: %d"quot); 


/* 

Output: 

numerator: 10.300000 
denominator: 4.500000 
remainder: 1.300000 
quotient: 2 

*/ 
-Thanks to Dayvison_ for linux binary.

Download

Github
Jelly23 is online now   Reply With Quote
Old 30/08/2017, 04:49 PM   #2
C4rtm4n
Gangsta
 
C4rtm4n's Avatar
 
Join Date: Jul 2017
Location: South Park
Posts: 591
Reputation: 13
Default Re: CMath Library

Good Plugin
__________________
No Projects At the moment

C4rtm4n is offline   Reply With Quote
Old 01/09/2017, 02:03 AM   #3
NathanT
Big Clucker
 
Join Date: Jul 2016
Location: Brazil
Posts: 172
Reputation: 13
Default Re: CMath Library

Good work, it is very interesting adding practical functions of C++ to PAWN.
__________________
NathanT is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] CMath Library Jelly23 Lançamentos/Releases 10 20/04/2017 05:50 PM
[Map] Library SjuteL Maps 16 18/04/2016 01:56 PM
[MAP] Library. SjuteL Screenshots and Videos 8 13/04/2016 11:27 PM
[Include] CRF Library codectile Includes 22 15/01/2015 11:56 AM


All times are GMT. The time now is 03:46 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.