Oddjump

From Esolang
Jump to navigation Jump to search

Oddjump is an esolang invented by User:None1, it is an esolang which does arithmetic operations on an infinite-precision real number and jump conditionally according to its parity.

Memory

The only memory is an infinite-precision real number, initially zero.

Commands

One command per line, space is mandatory.

x is any real number.

Command Meaning
+ x Add the real number by x
- x Subtract the real number by x
* x Multiply the real number by x
/ x Divide the real number by x
% x If floor(x) is odd, jump to line x (1-indexed) instead of moving on to the next command
. (optional) Output the real number
, (optional) Input the real number

Examples

XKCD Random Number

+ 4
.

Infinite loop

+ 1
% 2

Truth Machine

,
.
% 2

Computational class

Oddjump is Turing-complete because it can be translated from boolfuck: The binary representation is the tape and the decimal point is the pointer. Pointer moving can be done by multiplying and dividing by 2. Loops can be done using the % command, which checks the last bit of the integer part. What about increment and decrement? They become, of course, adding and subtracting by 1.

OISC Variant

We can combine all commands (except I/O commands) into one and get an OISC:

A B C: Let the real number be Ar+B (where r is the original real number), and if floor(r) is odd, jump to line C (1-indexed).

Examples

Infinite loop

0 1 1

Computational class

The OISC variant of Oddjump is Turing-complete as well, as it can do anything that standard Oddjump can do (except I/O).