Coding 2025-10-15
I'm on a bit of a time crunch because I took a melatonin ten minutes ago, so let's see if I can get some thoughts down really quickly.
If you're converting an integer to a natural number base, you can either start generating digits from the least significant digit (modular arithmetic and division), or the most significant digit (divide it until it is less than the base, then determine the current digit, then multiply). For algebraic bases, the most-significant-digit method seems easier to implement, because you're usually not going to know which digit is the least significant. For complex bases, the least-significant-digit method seems easier to implement, because it seems that complex bases have fractal boundaries between digits, instead of, like, points. I think using least-significant-digit for real integer bases seems somewhat more elegant, just because it's all remainder-less division, rather than dividing to create a fraction, then multiplying it back out.
I've worked out a few bits of information to account for:
- When a maximal version of a base exists (which will be algebraic, and therefore use msd), the "width" of the interval to divide to fit in is one plus the base, rather than the base.
- Positive non-balanced bases use the half-open interval from 0 to the width.
- Balanced real bases (because complex bases don't use the width) use the open interval from minus half the width, to half the width.
- Negative non-balanced bases use a few easily-calculated functions of the base which I don't have my notes for in front of me.
- Numbers in real integer bases may be represented by a one-element vector.
- Numbers in complex integer bases may be represented by a two-element vector.
- Numbers in real algebraic bases may be represented by a vector with the same number of elements as the degree of the polynomial.
- The complex vector can be sheared into the real numbers and then worked with modulo the number of digits in the base.
- The algebraic vectors can probably be manipulated to determine exactly whether specific thresholds are crossed, without relying on floating point.
And I'm also trying to hammer out some ideas for dealing with stuff like "a bunch of these bases have the same digits, but the vector representations are completely different, but in some way related to the specific digits".
I don't know exactly when I'll have time to really thoroughly work on this, but at least I managed to rewrite my code to patch attrs class magic methods so they can be used as an enum base class, to use aspectlib instead of unittest.mock. Like, that's probably better, right?
Anyway, I'm loopy now, so let's wrap this up and get to bed.
Good night.