algebra

means completeness and balancing, from the Arabic word الجبر

Books that inspired me.

Algebra book Quaternion and Octonion book

Real numbers

The algebra package exports R function which stands for Real number. It returns an object that implements arithmetic operators. You probably know about the floating point numbers issue, that is 0.1 + 0.2 does not equal 0.3. This is due to the floating point representation, it affects many programming languages. With algebra you can get the result you expect.


import { R } from 'algebra';

// Create a Real number with a value of 0.1
const x = new R(0.1);

// Add 0.2
x.add(0.2);

// Result is 0.3 as expected.
console.log(x.value); // 0.3