esolang

Trigbf

Brainfuck without plus and minus, where the only way to change a cell is sine, cosine or tangent.

None1, 2025 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: 4

The idea

None1 made Trigbf in 2025. It keeps brainfuck's tape, loops and input and output, and drops + and -. A cell holds a real number, and the only commands that change it are s, c and t, which take its sine, cosine or tangent in radians. Printing rounds to the nearest whole number.

Read the story

Every number has to be reached from 0 by chains of these functions. c turns 0 into 1. After that, tangent is the one that grows, since it shoots up near pi/2. Its code generator searches all short chains for each character. In the Hello World below, the H alone takes 12 commands.

Brainfuck stays Turing complete even if cells can only go from 0 to 1, and c does exactly that, so Trigbf is Turing complete too.

The machine

CommandDoes
s c tThe cell becomes its sine, cosine, tangent
> <Move on the tape, unbounded both ways
[ ]Loop while the cell is not exactly 0
. ,Print the rounded cell as a character; read a byte

The specification's interpreter computes with 100 digits. This one uses ordinary 64-bit numbers, which give the same output for every program in the specification.

Example

The Hello World by Blashyrkh builds the repeated letters once and prints them twice, moving back and…
Expected: HI!
Expected: trig

The Hello World by Blashyrkh builds the repeated letters once and prints them twice, moving back and forth over the tape.

Expected: Hello, world!

Further

Ideas it shows

Trigbf builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from Trigbf

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: trigbf.

Command line

shib run trigbf -e 'c[,.]' --input 'trig'
shib manual trigbf

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/trigbf.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org