---
title: "sortFloats"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737671/sortFloats"
format: markdown
---
# Description

Sorts a list of floating point numbers stored in an array.

## Functional area

System

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `sortFloats floatArray [-d]` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `floatArray` | float array | yes | The array to sort |

### Flags

> Macro (scroll-tablelayout)

| Name | Flag arguments | Argument type | Exclusive to | Comments |
| --- | --- | --- | --- | --- |
| `d` | 0 | — | — | Sorts in descending order. Default is to sort in ascending order. |

## Return value

float array

Returns the sorted array. 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Demonstrate a simple sort.
float $array[3];
$array[0] = 1.0;
$array[1] = -1.5;
$array[2] = 1e-6;
float $sortedArray[] = `sortFloats $array`;
print $sortedArray;
```

# Additional information

## Related commands

- [sortInts](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737268)
- [sortStrings](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736511)