[Tutorial] Full names of str and float functions
#1

I just made this tutorial real quick, as people tend do not using their brain when they ask what certain functions do.

I'll do a quick example of what this "tutorial" is about:

floatsqroot, for an example, is a function many don't know what does.
Well, if you did know the "full name", then you might know.
And by full name, I mean "Float Squareroot".

Credits:

[XST]O_x
Vince (For noticing a flaw)
Kyosaur
Y_Less (For correcting a huge mistake)
______________________
So yeah, here's a small list:
Code:
strtok		=   String Token(s)
strlen		=   String Lenght
strpack		=   String Pack (pack a string)
strunpack	=   String Unpack (obvious)
strcat 		=   String Concatenation
strins          =   String Insert
strdel          =   String Delete
strcmp          =   String Compare
strfind         =   String Find
strval          =   String to Value (integer)
valstr          =   Value (integer) to String
memcpy          =   Memory Copy
strmid		=   String Middle   =   Extraction of certain ranged characters from a string.
ispacked	=   Is String Packed   =   Checks if a string is packed or not
Code:
floatstr        =   String to Float
floatmul        =   Float Multiply  (*)
floatdiv        =   Float Divide    (/)
floatadd        =   Float Add       (+)
floatsub        =   Float Substract (-)
floatround      =   Float Round
floatcmp        =   Float Compare
floatsqroot     =   Float Squareroot
floatpower      =   Float Power     //Thanks, Y_Less
floatlog        =   Float Logarithm
floatsin        =   Float Sine
floatcos        =   Float Cosine
floattan        =   Float Tangent
floatfract	=   Float Fraction   =   Return a fractional portion of a float. //By kc.
floatabs	=   Float Absolute   =   Getting an absolute of a float. // Example: the float absolute of -1 and the float absolute of 1 are equal.
Code:
asin		=   arcsine
acos		=   arccosine
atan		=   arctangent
atan2		=   arctangent2 (variation of the first with 2 params)
Other's are free to reply with more examples in this list, then I'll edit and put it on the bottom of the list

And please no whining or trolling, it can actually be useful c:
Reply
#2

pawn Code:
strmid            =           String middle            =      Extraction of certain ranged characters from a string.

floatfract            =           Float fraction            =      Return a fractional portion of a float. //By kc.
Nice tutorial :3
Reply
#3

Added to the list!
Thank you! ^^
Reply
#4

Quote:
Originally Posted by LarzI
View Post
Added to the list!
Thank you! ^^
Sure, but you've accidentally added floatfract to the string functions list instead of the float function list :P

EDIT: Oh I see you fixed it already ^^
Reply
#5

I know, I saw it like 0.0001 second before I clicked Save x)
Fixed it now! ^^
Going to add list of all abbrievated functions, if people post some "suggestions", so I edited topic name too c:
Reply
#6

Handy list. Good work.
Just one small flaw:

Quote:
Originally Posted by LarzI
View Post
I just made this tutorial real quick, as people tend do not using their brain when they ask
Code:
floatstr        =   Float to String
String to Float.

And I'd be happy if anyone can me provide me with a WORKING example of the float power operator (^).
I tested some code with that operator, but even simple operations don't return anything.

pawn Code:
printf("%.1f", (25.0 ^ 0.5));
Should output 5.0, but just gives 0.0. (power 0.5 is the same as taking the square root of a value).
Reply
#7

Quote:
Originally Posted by Vince
View Post
Handy list. Good work.
Just one small flaw:


String to Float.

And I'd be happy if anyone can me provide me with a WORKING example of the float power operator (^).
I tested some code with that operator, but even simple operations don't return anything.

pawn Code:
printf("%.1f", (25.0 ^ 0.5));
Should output 5.0, but just gives 0.0. (power 0.5 is the same as taking the square root of a value).
Going to fix that ASAP, ty for noticing :]

Hmm, that is probably a bug, cause as you said; 25.0 ^ 0.5 should be 5 as 25.0 multiplied with itself 0.5 times is the same as getting the squareroot.
I'm sure some mathematic geniouses can answer this, someone like Y_Less, lol ^^

EDIT: I just tested this in a simple script:

pawn Code:
new Float:x = (25.0 ^ 0.5);
printf("%.1f - %.1f", floatpower(25.0, 0.5), x);
Output was:
Code:
5.0 - 0.0
Which means that floatpower(25.0, 0.5) does return 5.0, but my little variable returned 0.0, as you said.

EDIT AGAIN:
Quote:
Originally Posted by Pawn Language Guide
^
e1 ^ e2
results in the bitwise “exclusive or” of e1 and e2.
I guess floatpower is a "custom function", like shown in the pawn-lang:
pawn Code:
power(x, y)
{
/* returns x raised to the power of y */
assert y >= 0
new r = 1
for (new i = 0; i < y; i++)
r *= x
return r
}
Reply
#8

A bit more explanation to the functions and some examples would be nice, now you're just listing a heap of functions without even telling HOW it is used.
Reply
#9

Thanks, but all this is explained with examples in the wiki.
Reply
#10

Quote:
Originally Posted by Hiddos
View Post
A bit more explanation to the functions and some examples would be nice, now you're just listing a heap of functions without even telling HOW it is used.
I won't add explanations.
Reason?
Well, one of them is already told:

Quote:
Originally Posted by RyDeR`
View Post
Thanks, but all this is explained with examples in the wiki.
I just "cleared up" the abreviation for the people who doesn't know what it stands for.
Why I did this, was because many people wondered what floatsqroot, for an example, was.
And if they knew the full name of it, they'd probably know what it did too, without lots of explanation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)