Floatadd
From SA-MP Wiki
(Difference between revisions)
Revision as of 19:57, 1 September 2019 Freaksken (Talk | contribs) (Add redundant note) ← Previous diff |
Current revision Freaksken (Talk | contribs) (Parameter consitency with float.inc) |
||
Line 7: | Line 7: | ||
{{Note|This function is rather redundant, for it is no different than the conventional addition operator (+).}} | {{Note|This function is rather redundant, for it is no different than the conventional addition operator (+).}} | ||
- | {{Parameters|Float:Number1, Float:Number2}} | + | {{Parameters|Float:oper1, Float:oper2}} |
- | {{Param|Float:Number1|First float.}} | + | {{Param|Float:oper1|First float.}} |
- | {{Param|Float:Number2|Second float.}} | + | {{Param|Float:oper2|Second float.}} |
{{Returns|The sum of the two given floats.}} | {{Returns|The sum of the two given floats.}} |
Current revision
[edit]
floatadd
Note: This function name starts with a lowercase letter. |
Description:
Adds two floats together.
Note | This function is rather redundant, for it is no different than the conventional addition operator (+). |
(Float:oper1, Float:oper2)
Float:oper1 | First float. |
Float:oper2 | Second float. |
Return Values:
The sum of the two given floats.
Example Usage:
public OnGameModeInit() { new Float:Number1 = 2, Float:Number2 = 3; //Declares two floats, Number1 (2) and Number2 (3) new Float:Sum; Sum = floatadd(Number1, Number2); //Saves the Sum(=2+3 = 5) of Number1 and Number2 in the float "Sum" return 1; }
[edit]
Related Functions
The following functions may be helpful as they relate to this function in one way or another.
- Floatsub: Subtracts two floats.
- Floatmul: Multiplies two floats.
- Floatdiv: Divides a float by another.