Handbook · Reference · Blockly · Math
Blockly: Math
Where in the UI. Scripts tab toolbox.
Stock math plus Containd rounding, hex color ints, and random lists.
| Block id | Read as | Purpose |
|---|---|---|
math_number | number | Number literal. |
math_arithmetic | arithmetic | Add, subtract, multiply, divide, power. |
math_single | single | Sqrt, abs, negate, ln, log10, exp, trig inverses as listed on the block. |
math_trig | trig | Sin, cos, tan, and inverses. |
math_constant | constant | π, e, golden ratio, sqrt(2), sqrt(½), ∞. |
math_round | round | Round, round up, round down. |
containd_round_max_digits | round max digits | Round to at most N significant digits (e.g. 37.658→37.7 at N=3). When |value| ≥ 10^N, Math.round only (keeps all integer digits). No host call. |
containd_hex_color_to_int | hex color to int | Pack #RRGGBB / #RRGGBBAA (alpha last) to unsigned 32-bit 0xRRGGBBAA. |
containd_int_to_hex_color | int to hex color | Unpack unsigned 32-bit 0xRRGGBBAA to #RRGGBB (opaque) or #RRGGBBAA. |
math_modulo | modulo | Remainder of division. |
math_constrain | constrain | Clamp a number between bounds. |
math_random_int | random int | Random integer in a range. |
containd_random_float | random float | Sandbox Math.random — no host call |
containd_random_int_list | random int list | Sandbox Math.random — array of n inclusive ints (no host call) |
containd_random_float_list | random float list | Sandbox Math.random — array of n decimals (no host call) |