13.09.2012, 06:33
(
Последний раз редактировалось jameskmonger; 13.09.2012 в 08:48.
)
Ever wanted to easily handle a fraction? Now you can!
"decimal" will then be equal to 0.5.
The above script, when ran, will say "dec = 0.200000" and then "dec = 0.3".
This is my first include, I hope you enjoy it.
How to include
To use, just include the include file into your script! (I saved it as jInclude.inc in pawno/includes, so I used the below line in my script)pawn Код:
#include <jFraction>
How to use
And then you can use it like so:pawn Код:
new Float:decimal;
fractionToDecimal("1/20", decimal);
Examples
pawn Код:
new Float:dec;
fractionToDecimal("1/5", dec);
printf("dec = %f", dec);
fractionToDecimal("3/10", dec);
printf("dec = %0.1f", dec);
This is my first include, I hope you enjoy it.