💾 Archived View for tilde.cafe › ~stack › gemlog › 2022-10-21.fourth.doubles.gmi captured on 2024-08-31 at 13:05:57. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-07-22)

-=-=-=-=-=-=-

Forth double numbers are bass akwards

My forth (octiforth maybe?) is a 32-bit, i386 implementation. Partly because I was messing around with a 32-bit OS, partly because I like the minimalism/challenge of not-enough-registers.

Forth provides for double integers -- Forth was often 16 bits and double-ints were 32, but for a 32-bit forth 64-bit double-ints are sensible. Looking at some doc it appears that the two parts of a double are stored in a big-endian way: the high component is below the low.

This is a curiosity. Looking at Forth: the early years, the original word was on IBM EDPM704 at MIT in 1958 and later, Burroughs B5500, followed by some unspecified mini-computers in the 60s... I can't easily see if they were little- or big- endian.

Although who knows when doubles were added -- probably not until the 70s or 80s. Chuck mentions fixed-point arithmetic -14 or 30 bits right of a binary point for trig, 10 for logs...

It is more convenient for me to think of placing the high word high, and the low word low, on the stack and in-memory -- that is how 64-bit words are natively stored on any modern machine, and big-endian machines never made it to 64-bits as far as I can tell.

And for addition/subtraction it is more convenient to have at least one low-word in TOS; multiplication and division are slower and more rare anyway.

I am tempted to do it my way, ANSI Forth be damned...

index

home