npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

90deg

v0.2.2

Published

90deg is an OISC around vector dot product and addition

Readme

90deg

90deg is an OISC (one instruction set computer) based on perpendicular vectors, vector dot product, and vector addition.

Basics

Start off with an nD vector (3D in this case, and that should be enough already) s(a, b, c) as the original state. Each 90deg command takes up 2n+1 parameters (7 in this case), with the first n params being the coordinates of the a vector, the next n params being the coordinates of the b vector, and the last param being a number d. Calculate dot product of s and a, if it is 0 (perpendicular), jump to the next command, otherwise add b to s and jump to command d. It halts simply when all dot products are 0 (no commands can be run) or enter an infinite loop with some conditions. Note that all values are unbounded signed integers.

For example, here is how to calculate 3+2:

s = (3, 2, 0)

(1, 0, 0) (-1, 0, 1) 1
(0, 1, 0) (0, -1, 1) 0

State changes:

s = (2, 2, 1)
s = (1, 2, 2)
s = (0, 2, 3)
s = (0, 1, 4)
s = (0, 0, 5)

As we can see, the z coordinate is now 5 which is the result of 3+2.

Turing completeness

2-counter machine

To prove that 90deg is turing complete, we can prove that it is able to simulate a 2-counter machine, which is turing complete.

A 2-counter machine consists of:

  • Two unbounded integer registers.
  • INC(x) command to increment the value of register x.
  • DEC(x, i) command to decrement the value of register x if it is not zero and jump to command i, otherwise jump to the next command.

90deg as a 2-counter machine

A 3D vector s can already represent two registers with its coordinate x and y.

The DEC command can be implemented by calculating the dot product of vector s and vector a that has value 1 in the coordinate (register) we want to check and 0 in other coordinates. For example:

s(2, 1, 0) . a(1, 0, 0) = 2 * 1 + 0 + 0 = 2
s(3, 0, 2) . a(0, 1, 0) = 0 + 0 * 1 + 0 = 0

A 90deg command adds the vector b to the vector s and jumps to some command i if the dot product is not zero. If it is zero, s is not modified and the program jumps to the next command. Thus, we can recreate DEC by making b's coordinates negative.

The INC command can be simulated by forcing the z coordinate of s to always be non-zero. For instance, you can define s as (a, b, 1), then calculate dot product of s and a(0, 0, 1). The result would always be non-zero, then you can add b(m, n, 0) to s to increment whatever registers you like.

The 90deg virtual machine

This repo also comes with a 90deg vm/interpreter in 90deg.js. To use it, create another JS file:

const vm = require("./90deg");

vm.run(
    // s vector
    [ 3n, 2n, 0n ],
    // code
    [
        1n, 0n, 0n, -1n, 0n, 1n, 0n,
        0n, 1n, 0n, 0n, -1n, 1n, 0n
    ],
    // log per state change, default is true
    true
);

To make it nD, you can simply increase the dimension (length) of the s vector (array) and the VM will adapt.

Note that vm.run directly mutates the s vector and returns a reference to it as well.

NPM

You can use 90deg as an npm package. First, install:

npm install 90deg

Then import:

const vm = require("90deg");

CDN

Or just use 90deg in a browser:

<script src="https://unpkg.com/90deg"></script>

Examples

Example 90deg programs can be found in ./examples/.

Copyrights and License

Copyrights © 2025 Nguyen Phu Minh.

This project is licensed under the Apache 2.0 License.