Create: Factory Controller

Arithmetic Tube

Arithmetic tube is an item added by this mod. It can be placed in factory controllers to to perform arithmetic operations, such as addition, multiplication, division, rounding and trigonometry.

Arithmetic tubes primarily connect with other components via number connections. They may be used to obtain information from or control components such as factory gauges and redstone links.

arithmetic tube samples
Figure 1. Arithmetic tubes with various operators
arithmetic tube example
Figure 2. An arithmetic tube calculating the ratio between iron and gold ingots monitored by factory gauges

Obtaining

arithmetic tube recipe tree
Figure 3. Recipe tree of arithmetic tubes (by EMI)
  1. Cut an amethyst shard into 2 cut amethyst with a stonecutter or mechanical saw.
  2. Each cut amethyst can be crafted with an iron plate into an arithmetic tube.

Operating Principle

An arithmetic tube can perform various calculations depending on its selected operator. Arithmetic operators can be categorized by the number of inputs they accept, referred to as the arity.

Table 1. Arithmetic operators categorized by arity
N-ary
(accept any number of inputs)
+
Sum
×
Product
max
Maximum
min
Minimum
Binary
(accept exactly 2 inputs)
-
Subtract
÷
Divide
xy
Power
y√x̅
Root
log
Logarithm
Unary
(accept exactly 1 input)
| |
Absolute
⌈ ⌉
Celing
⌊ ⌋
Floor
sgn
Sign
sin
Sine
cos
Cosine
tan
Tangent

Each input corresponds to an incoming number connection, or a constant. The result is propogated to the output after 1 tick.

Numbers are 64-bit floating point values. They can represent fractional values, but their precision is limited. Slight rounding may occur during calculation. Integers outside the range ±253 may not be exact. Dividing a non-zero number by 0 results in ∞ or -∞.

Basic Configuration

arithmetic tube settings
Figure 4. Arithmetic tube settings
❶ Operator selection menu
Click to open a menu to select an arithmetic operator.
❷❸❹ Input entry
Shown for each input of this arithmetic tube.
❷ Input source icon
Shows the source of this input, such as the component at the other end of the number connection.
❸ Input value
Shows the value of this input.
❹ Remove input button
Click to remove this input.
❺ Result
Shows the result of calculation.
❻ Relocate button
Click to move the location of this tube on the virtual board.
❼ Add connection button
Click to connect another component as an input, or to a redstone signal.
❽ Add constant button
Click to add a constant.
❾ Confirm button
Click to confirm settings and close this screen.

For binary operators, the 2 inputs are distinguished as primary (blue) and secondary (red) input. Their roles in relation to the operator is typically displayed in ❶. They may be swapped by clicking ❿.

arithmetic tube settings binary
Figure 5. Arithmetic tube settings with a binary operator

Switching between operators with different arities is sometimes disallowed. In that case, remove inputs so that the number of inputs aligns with the new operator.

Constant

Clicking Figure 4 ❽ creates an editable constant as an input. On a constant input, click ❸ and type to set the constant to arbitrary values. You may enter any number in decimal, or computerized scientific notation (e.g. 1e2 for 100).

arithmetic tube constant input
Figure 6. Settings with a constant
arithmetic tube constant input edit
Figure 7. Editing a constant

Additionally, the special constants π, τ, e, ∞ and -∞ can be entered via the ⏷ dropdown menu, or typed in their literal or English form.

Redstone

An arithmetic tube can also be connected to other components via redstone connections, such as with logical tubes and redstone links.

Redstone Input

When connected by redstone as a sink, the behaviour of the arithmetic tube when powered by redstone can be configured.

arithmetic tube settings redstone input
Figure 8. Settings with an incoming redstone connection

2 options can be selected by scrolling on ❶:

Override
When powered by redstone, override the output to the number specified in ❷.
Hold
When powered by redstone, hold the output at its current value.

Redstone Output

When connected by redstone as a source, the arithmetic tube can be configured to compare the numerical result with a constant, and output a redstone signal when the comparison is satisfied.

arithmetic tube settings redstone output
Figure 9. Settings with an outgoing redstone connection

Scroll on ❶ to select a comparator (>, <, =, ≥, ≤, ≠), click ❷ to enter the number to compare to.