Inventing Your Own Math as a Computer Programmer A developer extended a C library for algebraic number theory, previously limited to integer arithmetic in finite fields, to support floating-point operations by representing complex quadratic primes as a + bω and regular complex numbers as x + yi. The work adds number-field root and generator evaluation via the identity √-r = i√r, coordinate conversion between rectangular and lattice geometries such as the Eisenstein hexagonal plane, and complex arithmetic rules keyed to Heegner numbers, with division excluded due to numerical instability. The author frames the effort as groundwork for a 'complex number unit' CPU aimed at neural net quantization, factorization, Pell curves and discrete logs. God made the integers, all the rest is the work of man. ~ Leopold Kronecker 1.0 Introduction Part 1 https://leetarxiv.substack.com/p/special-q-descent-and-lattice-sieving-931 explored the discovered side of algebraic number theory, and we built a C library for working with complex quadratic primes of the form x² + ny² modulo a prime number p. However, modern computers run on floating-point arithmetic, not integer operations in a finite field. Now, we must invent our own math to accommodate floating point operations in our algebraic number theory library. We’re building a complex number unit . It’s a CPU designed for working with imaginary numbers. Useful for neural net quantization https://leetarxiv.substack.com/p/sherry-tequila-and-fairy-in-python , factorization https://leetarxiv.substack.com/p/continued-fractions-and-lattice-sieving , pell curves https://leetarxiv.substack.com/p/pell-equation-over-a-finite-field and discrete logs https://leetarxiv.substack.com/p/computation-of-discrete-logarithms-gaussian-eisenstein . 1.1 Quick Primer We covered all this in detail in Part 1 https://leetarxiv.substack.com/p/special-q-descent-and-lattice-sieving-931 . Our library works with a subset of complex prime numbers of the form: Where r is drawn from the Heegner numbers: When r = 2 , this complex quadratic primes are the Gaussian integers https://leetarxiv.substack.com/i/179533821/22-gaussian-integer-sieve . r = 3 is called an Eisenstein integer https://leetarxiv.substack.com/i/179533821/31-ring-of-eisenstein-integers . Arithmetic happens in a ring or a field depending on r . Here’s a quick cheatsheet: 2.0 Floating Point Extensions