---
name: "BIS_fnc_roundDir"
type: function
status: ok
groups: ["Math"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_roundDir
revid: 327918
updated: 2022-07-13T12:12:29Z
---

# BIS_fnc_roundDir

*Function · Math · Arma 3 v0.50 · introduced in Take On Helicopters v1.00*

## Description

Round direction to nearest set rounding; used for determining cardinal direction.

## Syntax

```sqf
[rawDirection, rounding] call BIS_fnc_roundDir
```

**Parameters:**

- `rawDirection`: [Number](../topics/Number.md) - direction to round
- `rounding`: [Number](../topics/Number.md) - (Optional, default 90) - rounding value. With 90° possible return values are 0, 90, 180 and 270

**Returns:** [Number](../topics/Number.md) - rounded direction, depending on input. **Can be negative or over 360**

## Examples

### Example 1

```sqf
player setDir ([getDir player, 45] call BIS_fnc_roundDir);
```

### Example 2

```sqf
[204.2, 10] call BIS_fnc_roundDir; // will return 200
```

### Example 3

```sqf
[271, 180] call BIS_fnc_roundDir; // will return 360
```

### Example 4

```sqf
70 call BIS_fnc_roundDir; // will return 90
```

## See also

[setDir](../commands/setDir.md) · [getRelDir](../commands/getRelDir.md) · [round](../commands/round.md)

<sub>Source: [BI Community Wiki — BIS fnc roundDir](https://community.bistudio.com/wiki/BIS_fnc_roundDir) (revision 327918).</sub>
