Back to Node List

Math Func

math_func

Applies a common single-input math function to a number

Reviewed
Guide available
The node name and summary are available in English. Port, parameter, and article details are currently shown in Japanese.

Input Ports

NameTypeDescription
入力
input
Number
Required
計算したい数値です

Output Ports

NameTypeDescription
value
Number
計算した結果の数値です

Parameters

NameTypeDefaultRangeDescription / Options
計算の種類
func
Enum
Abs

どの計算をするか選びます

  • 絶対値Abs
    マイナスをプラスにした値を返します。例: -3 → 3
  • 切り捨てFloor
    負の方向へ切り下げます。例: -1.2 → -2
  • 切り上げCeil
    小数点以下を切り上げます。例: 3.2 → 4
  • 四捨五入Round
    いちばん近い整数に丸めます。例: 3.5 → 4
  • 小数だけFract
    小数部分だけを取り出します。例: 3.8 → 0.8
  • 平方根Sqrt
    平方根を返します。例: 9 → 3
  • サインSin
    sin(x) を返します。角度ではなくラジアンで計算します
  • コサインCos
    cos(x) を返します。角度ではなくラジアンで計算します
  • タンジェントTan
    tan(x) を返します。角度ではなくラジアンで計算します
  • 指数 e^xExp
    e(約2.718) の x 乗を返します。例: 3 → 20.085...
  • 自然対数Log
    自然対数 ln(x) を返します。e を底にした対数です
  • 符号反転Negate
    プラスとマイナスを反転します。例: 3 → -3
  • 符号判定Sign
    負なら -1、0 なら 0、正なら 1 を返します

Overview

Applies one function—such as absolute value, rounding, or a trigonometric function—to one number. Together with the two-input math_op, it is another fundamental building block for numeric wiring.

Usage tips

  • Rounding functions are especially useful in pixel art. Converting coordinates or indices to integers with Floor / Round produces motion that snaps to pixels. To turn a smooth waveform into stepped motion, combine Floor with multiplication by the number of steps.
  • Abs folds a round trip into one direction: a waveform from -1 to 1 becomes two peaks from 0 to 1.
  • Sin / Cos expect radians. To work in degrees, multiply by 0.01745 (π/180) in a preceding math_op(Multiply).

Related nodes

  • math_op — two-input operations
  • expression_float — write an expression such as floor(x*4)/4 in one node
  • remap — convert ranges, often before or after rounding

Functions

  • Abs
    • Absolute value. Converts a negative value to positive. Example: -3 -> 3
  • Floor
    • Rounds down toward negative infinity. Example: -1.2 -> -2
  • Ceil
    • Rounds up. Example: 3.2 -> 4
  • Round
    • Rounds to the nearest integer. Example: 3.5 -> 4
  • Fract
    • Extracts only the fractional part. Example: 3.8 -> 0.8
  • Sqrt
    • Square root. Example: 9 -> 3
  • Sin / Cos / Tan
    • Trigonometric functions calculated in radians, not degrees.
  • Exp
    • Calculates e^x, or e (approximately 2.718) to the power of x. Example: 3 -> 20.085...
  • Log
    • Natural logarithm ln(x), using e as the base.
  • Negate
    • Reverses the sign, swapping positive and negative. Example: 3 -> -3
  • Sign
    • Tests the sign. Returns -1.0 for a negative value, 0.0 for zero, and 1.0 for a positive value.

Notes

  • Sqrt accepts only inputs greater than or equal to 0.
  • Log accepts only inputs greater than 0.
  • The value currently returned at runtime is Float, while the port contract is Number.

Examples

  • Use Abs to make values from Noise Wave positive.
  • Insert Floor before Remap to create steps.
  • Build periodic motion with Sin / Cos.
  • Use Sign to switch direction depending on whether a value is positive or negative.
Back to Node List
Math Func — PixPipeline Node Reference