# Number Nodes Numeric values: conversion, arithmetic, comparison, clamping, averaging and random numbers. _9 nodes._ | Node | Registry path | | --- | --- | | [As Number](#as-number) | `data/number/AsNumber` | | [Average](#average) | `data/number/Average` | | [Basic Arithmetic](#basic-arithmetic) | `data/number/BasicArithmetic` | | [Clamp](#clamp) | `data/number/Clamp` | | [Compare](#compare) | `data/number/Compare` | | [Make Number](#make-number) | `data/number/Make` | | [Min Max](#min-max) | `data/number/MinMax` | | [Random](#random) | `data/number/Random` | | [Sum](#sum) | `data/number/Sum` | ## As Number `data/number/AsNumber` Converts a value to a number Converts a value to a number, handling both string and numeric inputs. A value that cannot be converted raises an error. **Inputs** | Input | Type | Description | | --- | --- | --- | | `value` | `any` | The value to convert to a number | | `default` | `any` | Fallback value used when ``value`` is unresolved or None | **Outputs** | Output | Type | Description | | --- | --- | --- | | `value` | `int,float` | The converted number value | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `number_type` | `str` | `"int"` | Type of number to create. Choices: `int`, `float`. | ## Average `data/number/Average` Calculates average of a list of numbers Calculates one of three types of average (mean, median, or mode) from a list of numeric values. **Inputs** | Input | Type | Description | | --- | --- | --- | | `numbers` | `list` | List of numbers to calculate average from | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `int,float` | The calculated average value (mode yields None when there is no unique mode) | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `method` | `str` | `"mean"` | Type of average to calculate. Choices: `mean`, `median`, `mode`. | ## Basic Arithmetic `data/number/BasicArithmetic` Performs basic arithmetic operations Performs one of the following operations on two input values: add, subtract, multiply, divide, power, or modulo. **Inputs** | Input | Type | Description | | --- | --- | --- | | `a` | `int,float` | First operand (number) | | `b` | `int,float` | Second operand (number) | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `int,float` | Result of the arithmetic operation (division or modulo by zero raises an error) | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `operation` | `str` | `"add"` | Arithmetic operation to perform. Choices: `add`, `subtract`, `multiply`, `divide`, `power`, `modulo`. | | `a` | `number` | `0` | First operand | | `b` | `number` | `0` | Second operand | ## Clamp `data/number/Clamp` Constrains a number within a specified range Takes a value and ensures it falls within a specific minimum and maximum range. If the value is below the minimum, it returns the minimum. If it's above the maximum, it returns the maximum. **Inputs** | Input | Type | Description | | --- | --- | --- | | `value` | `int,float` | The number to constrain | | `min` | `int,float` | Minimum allowed value | | `max` | `int,float` | Maximum allowed value | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `int,float` | The value constrained to the specified range | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `value` | `number` | `0` | The number to constrain | | `min` | `number` | `0` | Minimum allowed value | | `max` | `number` | `1` | Maximum allowed value | ## Compare `data/number/Compare` Compares two numbers Performs comparison operations between two numeric values with optional tolerance for floating point comparisons. **Inputs** | Input | Type | Description | | --- | --- | --- | | `a` | `int,float` | First value to compare (number) | | `b` | `int,float` | Second value to compare (number) | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `bool` | Boolean result of the comparison | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `operation` | `str` | `"equals"` | Comparison operation to perform. Choices: `equals`, `not_equals`, `greater_than`, `less_than`, `greater_equal`, `less_equal`. | | `tolerance` | `float` | `0.0001` | Tolerance for floating point comparison | | `a` | `number` | `0` | First value to compare | | `b` | `number` | `0` | Second value to compare | ## Make Number `data/number/Make` Creates a number with a specified value Creates either an integer or floating point number with the specified value. **Outputs** | Output | Type | Description | | --- | --- | --- | | `value` | `any` | The created number value | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `value` | `number` | `0` | The numeric value to create | | `number_type` | `str` | `"float"` | Type of number to create. Choices: `int`, `float`. | ## Min Max `data/number/MinMax` Finds minimum or maximum in a list of numbers Takes a list of numbers and finds either the minimum or maximum value, returning both the value and its index in the list. **Inputs** | Input | Type | Description | | --- | --- | --- | | `numbers` | `list` | List of numbers to analyze | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `int,float` | The minimum or maximum value | | `index` | `int` | The index position of the minimum or maximum value in the list | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `operation` | `str` | `"min"` | Operation to perform. Choices: `min`, `max`. | ## Random `data/number/Random` Generates random numbers Generates random numbers using various distributions (uniform, integer, normal) or selects a random item from a list of choices. **Inputs** | Input | Type | Description | | --- | --- | --- | | `min` | `int,float` | Minimum value for uniform/integer distribution (optional) | | `max` | `int,float` | Maximum value for uniform/integer distribution (optional) | | `mean` | `int,float` | Mean value for normal distribution (optional) | | `std_dev` | `int,float` | Standard deviation for normal distribution (optional) | | `choices` | `list` | List to select a random item from (optional) | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `int,float` | The generated random number or selected item | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `method` | `str` | `"uniform"` | Type of random number to generate. Choices: `uniform`, `integer`, `normal`, `choice`. | | `min` | `float` | `0.0` | Minimum value for uniform/integer distribution | | `max` | `float` | `1.0` | Maximum value for uniform/integer distribution | | `mean` | `float` | `0.0` | Mean value for normal distribution | | `std_dev` | `float` | `1.0` | Standard deviation for normal distribution | ## Sum `data/number/Sum` Sums a list of numbers Calculates the sum of all values in a list of numbers. **Inputs** | Input | Type | Description | | --- | --- | --- | | `numbers` | `list` | List of numbers to sum | **Outputs** | Output | Type | Description | | --- | --- | --- | | `result` | `int,float` | The sum of all numbers in the list | **Properties** | Property | Type | Default | Description | | --- | --- | --- | --- | | `numbers` | `list` | `[]` | List of numbers to sum |