Endianness macros

P

Paul J Gans

James Kuyper said:
[...]
Europeans kept the high-order digit on the left, making the
same number "123" big-endian (perhaps also influenced by Roman
numerals being big-endian: "CCCXXI").

CXXIII?

IXXCCC

Apparently I'm being dense today, and am not getting the joke.

Change both systems from big-endian to little-endian, i.e. reverse the
numerals:

CCCXXI = 321
IXXCCC = 123
Actually, that's an example of a subtractive Roman Numeral. The Romans
themselves didn't use them - it was invented in the 13th century CE.
When a roman numeral with a lower value was written to the left of one
with a higher value, it was subtracted from the higher one, rather than
added to it. For instance, IV = 4, IX = 9. I gather that there's a lot
of inconsistency and disagreement about the handling of subtractive
Roman numerals, and I didn't find any examples involving multiple
subtractions. My personal opinion is that IXXCCC = 300 - 20 - 1 = 279.

But one can take IXX to be 19 so that IXXCC = 300 - 19 = 281... ;-)
 
K

Keith Thompson

James Kuyper said:
[...]
Europeans kept the high-order digit on the left, making the
same number "123" big-endian (perhaps also influenced by Roman
numerals being big-endian: "CCCXXI").

CXXIII?

IXXCCC

Apparently I'm being dense today, and am not getting the joke.

Change both systems from big-endian to little-endian, i.e. reverse the
numerals:

CCCXXI = 321
IXXCCC = 123

Actually, that's an example of a subtractive Roman Numeral. The Romans
themselves didn't use them - it was invented in the 13th century CE.
When a roman numeral with a lower value was written to the left of one
with a higher value, it was subtracted from the higher one, rather than
added to it. For instance, IV = 4, IX = 9. I gather that there's a lot
of inconsistency and disagreement about the handling of subtractive
Roman numerals, and I didn't find any examples involving multiple
subtractions. My personal opinion is that IXXCCC = 300 - 20 - 1 = 279.

I didn't intend it to be subtractive.

And I just noticed that I screwed up the Roman numeral example
above, which probably led to some confusion as some people either
took me seriously or assumed I was making a joke that I didn't
actually intend.

The number "one hundred twenty-three" is written in the left-to-right
big-endian Hindu-Arabic numerals we commonly use as "123". It's also
written in right-to-left little-endian Hindu-Arabic numerals as
"123", but the '3' is first; I understand that that's how it's
actually done in Arabic. Europe adopted the numbering system from
the Arabs (thanks to Fibonacci) and kept the same left-to-right
order, but reinterpreted it as left-to-right big-endian. Which is
why many of us see big-endian as a more "natural" ordering.
(I don't know why the Arabs, picked a little-endian ordering.)

Roman numerals are also written in left-to-right big-endian form,
so 123 is "CXXIII" (which is what I *should* have written in the
first place). If Roman numerals were in left-to-right little-endian
form, the same number would be written as "IIIXXC".
 
K

Keith Thompson

Stephen Sprunk said:
You missed the joke too, apparently.


I was taught in grade school was that you could only subtract one of the
next-lower numeral, with an exception for IX. That's consistent with
movie copyright notices (why are they in Roman numerals anyway?), e.g.
1999 was written MCMLXLIX rather than MIM, MCMIC, MCMXCIX, etc.

Quidquid Latine dictum sit altum videtur.

I believe 1999 is written MCMXCIX.

I was taught that:
- A single I can be subtracted from a following V or X
- A single X can be subtracted from a following L or C
- A single C can be subtracted from a following D or M

Exception: The 4 on a clock face is written IIII, not IV (but 9 is still
written IX).
If it were in big-endian form, sure. In little-endian form, though,
it's 123 (LE) or 321 (BE).

In traditional Roman numbers *as I was taught them*, IXXCCC is a syntax
error.
 
S

Stephen Sprunk

But doing that means also reassigning the symbols for the digits.
It would be like claiming that 123 in little endian form was 678
(assuming that you'd swap the meanings of 0/9, 1/8, 2/7, 3/6, 4/5,
just like the some of the above samples swap C and I). So I'd
(sort-of) accept IIIXXC as the little endian form of 123, but not
the versions with "CCC".

Why would you need to reassign the digits, though? Endianness just says
whether the most or least significant digit comes first. In the above
examples, three hundred twenty-one is written as:

321 in big-endian (i.e. normal) Arabic numerals
123 in little-endian Arabic numerals
CCCXXI in big-endian (i.e. normal) Roman numerals
IXXCCC in little-endian Arabic numerals

(How many times will I mistakenly type "numberals" today? Sheesh.)

S
 
S

Stephen Sprunk

The example was 123 in big endian order. Which, in right-to-left
Arabic, is effectively little endian, but is still written with the 1
on the leftmost end.

Ah, I was looking at the CCCXXI in the example, not the 123. I didn't
notice the example wasn't self-consistent.

S
 
D

David Thompson

David Thompson wrote: <snip:

No doubt with several "this page intentionally left blank". :)
Certainly no more than one was needed, and I don't recall if ANSI was
(then) paranoid about marking. IBM definitely was, FWIW.
This is amusing. This being said, if you look at this data stream with
an o-scope, the MSB is still on the left :)
Huh? Every 'scope I've used swept from left to right, so the first bit
sent, which is least significant, would be at left. Of course, for
truly async characters you would need a triggered scope to see them
consistently, and in the 1960s triggered was extra cost and rare.
For synchronous transmission (which was rarer for ASCII, but not
unknown), or for nominally async but continuous transmission (like
paper-type devices or most computer output) you could just clock at
10Hz, or 30Hz, or whatever.

At least in the US; I might wonder if they might be right to left in
UK, or Israel/Arab countries, or Japan/China/etc. I doubt it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Endianness macros 4
I know VBA (macros) - nothing else! 0
Macros 28
bitwise operator and endianness 5
about macros 4
Changing endianness 8
Macros 16
Bit shifts and endianness 72

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top