Skip to content

← elementwise_math package

Round

Round each element to a given precision.

This node supports several rounding modes. Note that the "round" mode uses the "round half to even" rule. More Info... Version 1.2.0

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
INOUT

rounding_mode

Rounding mode.

verbose name
Rounding Mode
default value
round
port type
EnumPort
value type
str (can be None)

precision

Number of decimal places to round to. If 0, round to the nearest integer.

verbose name
Precision
default value
0
port type
IntPort
value type
int (can be None)

out_type

Desired output type. If set to 'same', the output is of the same type as the input (but note that, as with all elementwise operations, when processing a list of mixed integer and float types, the entries will be converted to a common type that can represent all entries, i.e. float). If set to 'float', the output is generally of floating-point type, and otherwise of integer type (in both cases of the same precision as the input). Note that the default behavior in versions of NeuroPype prior to 2023.0.2 was similar to 'same' but had inconsistent behavior when the input was a single floating-point value: a) in 2022.0 and older, the round mode would return an integer, while from 2023.0 onwards it would return the same type as the input, and b) the 'floor', 'ceil', and 'trunc' modes added in 2023.0.0 initially returned an integer in this situation, while from 2023.0.2 onwards they now return the same type as the input like the 'round' mode. Note that the precision setting does not influence the output type, and it is an error to set output to int and select a precision greater than 0.

verbose name
Output Type
default value
same
port type
EnumPort
value type
str (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)