round: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(see also)
No edit summary
Line 38: Line 38:
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on February 23, 2018 - 05:21 (UTC)</dd>
<dt class="note">[[User:feint|feint]]</dt>
<dd class="note"> If you want to round to a specific place past the decimal point, use [[toFixed]] and [[parseNumber]] together.<br><br>For example:
<code>[[parseNumber]] (3.16666 [[toFixed]] 1); // 3.2</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 07:21, 23 February 2018

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Rounds up or down to the closest integer.
Groups:
Uncategorised

Syntax

Syntax:
Number = round x
Parameters:
x: Number
Return Value:
Number

Examples

Example 1:
_val= round 5.25, result is 5
Example 2:
_val= round 5.55, result is 6

Additional Information

See also:
ceilfloorlinearConversionMath Commands

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section

Posted on February 23, 2018 - 05:21 (UTC)
feint
If you want to round to a specific place past the decimal point, use toFixed and parseNumber together.

For example: parseNumber (3.16666 toFixed 1); // 3.2