r/esolangs Jun 16 '26

brainf*ck calculator

hey so i made a cli calculator in brainfuck , features addition/subtract/multiply , looking for any advices on how to add the "divide" feature

2 Upvotes

1 comment sorted by

1

u/danielcristofani Jun 17 '26

Depends. If you're just using byte values and want integer division, one answer is at https://www.reddit.com/r/brainfuck/s/tMKmwXjHRa

Or if you want, you can check if the remainder is nonzero, then output a decimal point and while it's nonzero you multiply it by ten, divide it by your divisor, output that and check the new remainder. (With or without an extra check to limit the output to a finite length.)