Skip to content

Instantly share code, notes, and snippets.

View howerj's full-sized avatar

Richard James Howe howerj

View GitHub Profile
@howerj
howerj / if.c
Created April 6, 2023 21:39
Operators for comparision using only SUBLEQ
/* This short program uses Less-Than-Or-Equal-To-Zero
* to create the various signed comparison operators.
*
* The reason for this program is to understand how
* those operators can be implemented on a SUBLEQ
* One Instruction Set Computer.
*
* It is trivial to construct addition, subtraction
* and branching with the SUBLEQ machine, but the
* comparison and bitwise operators are more complex.
/** A simple kalman filter example by Adrian Boeing
www.adrianboeing.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double frand() {
return 2*((rand()/(double)RAND_MAX) - 0.5);