> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuro-tech.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Tested Script function reference

> Use exact core Script signatures for numbers, strings, collections, and conversions with executable examples

These examples have been checked using `Waher.Script` 2.15.0. They require no host variables or external service. Your Neuron still determines whether each function is allowed in a particular execution context.

For the full syntax and function catalog, use the [original Script reference](https://lab.tagroot.io/Script.md).

The entries describe tested input types. They are a focused application reference, not a claim that every runtime overload or extension is available. See [execution contexts and persistence](/script/runtime-functions) before embedding them in a contract.

## Abs(x)

Real number; returns non-negative magnitude.

```text theme={null}
Abs(-3)
```

Expected result: `3`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Abs.cs).

## Round(x)

Real number; returns the nearest integer-valued number, with midpoint ties to even.

```text theme={null}
Round(2.5)
```

Expected result: `2`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Round.cs).

## Floor(x)

Real number; returns the greatest integer-valued number no larger than the input.

```text theme={null}
Floor(-2.3)
```

Expected result: `-3`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Floor.cs).

## Ceiling(x)

Real number; returns the least integer-valued number no smaller than the input.

```text theme={null}
Ceiling(-2.3)
```

Expected result: `-2`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Ceiling.cs).

## Min(x, y)

Two real numbers; returns the smaller value.

```text theme={null}
Min(3,8)
```

Expected result: `3`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Min.cs).

## Max(x, y)

Two real numbers; returns the larger value.

```text theme={null}
Max(3,8)
```

Expected result: `8`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Max.cs).

## Number(x)

Numeric text in the tested example; returns a number. Invalid numeric text raises an error. Alias: Num.

```text theme={null}
Number("12.5")
```

Expected result: `12.5`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/Number.cs).

## String(x)

Numeric value in the tested example; returns its text representation. Alias: Str.

```text theme={null}
String(12.5)
```

Expected result: `"12.5"`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Scalar/String.cs).

## Length(s)

String; returns the string length. The tested example is ASCII text.

```text theme={null}
Length("Neuro")
```

Expected result: `5`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Strings/Length.cs).

## Trim(s)

String; returns text with leading and trailing whitespace removed.

```text theme={null}
Trim("  note  ")
```

Expected result: `"note"`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Strings/Trim.cs).

## StartsWith(s, prefix)

Two strings; returns whether the string begins with the prefix.

```text theme={null}
StartsWith("Neuro", "Neu")
```

Expected result: `true`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Strings/StartsWith.cs).

## Sum(v)

Vector of real numbers; returns their sum.

```text theme={null}
Sum([1,2,3])
```

Expected result: `6`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Vectors/Sum.cs).

## Count(v)

Vector; returns the number of entries.

```text theme={null}
Count([1,2,3])
```

Expected result: `3`. [Selected function source](https://github.com/PeterWaher/IoTGateway/blob/43705bab39e89da8f2e5e4d72c55cba6f2a43bbd/Script/Waher.Script/Functions/Vectors/Count.cs).

## Handle invalid input

`Number("not a number")` raises an evaluation error in the same test suite. Validate input types and choose a deliberate error or fallback policy. `Round` uses ties-to-even; a payment integration must define its own units and rounding requirements.

The [reference metadata](/downloads/script-function-reference.json) records source revision and test-case identifiers. Each entry includes the expression and expected result; start with the [Script quickstart](/script/quickstart) for a worked calculation.
