Base Converter
The LGP-30's word held 31 bits of magnitude plus a sign bit — but the
machine actually stored negatives as the two's complement of that 31-bit field,
not plain sign-magnitude (the manual's own example: 6 is 0 011000…0,
-6 is 1 101000…0, the complement-plus-one of the positive
pattern, not the same magnitude with the sign bit merely flipped). This converter
keeps things simpler — sign and magnitude tracked separately, not the
two's-complement quirk — so treat it as a nod to the machine's word size,
not a hardware emulation. A programmer working out an address or an operand by
hand had to move fluently between decimal, octal, binary, and eventually
hexadecimal — and, for fixed-point work, a binary fraction after the point.
This converter works the same way: enter a value in any field, with an optional
leading - on the whole number, and the others update as you type.
Integer magnitude is capped at 31 bits (0–2,147,483,647), matching the LGP-30's word; the binary fraction is capped at 31 bits too. Decimal fractions that aren't exact powers of a half (like .1) are rounded to the nearest 31-bit binary value, same as any fixed-point machine would.
The LGP-30 itself could only ever hold a signed fraction strictly between -1 and 1. To handle a value of any size, a programmer picked a scale factor q once and encoded every constant the same way: a binary fraction times 2q. Q below defaults to the smallest exponent that fits the value above; type your own to see how it encodes at a scale factor you've already fixed for the rest of a program — it'll flag an error if the value can't fit at that scale.