Endianness macros

Discussion in 'C Programming' started by James Harris, Aug 23, 2013.

  1. James Harris

    Paul J Gans Guest

    But one can take IXX to be 19 so that IXXCC = 300 - 19 = 281... ;-)
     
    Paul J Gans, Aug 30, 2013
    #41
    1. Advertisements

  2. 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".
     
    Keith Thompson, Aug 30, 2013
    #42
    1. Advertisements

  3. 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).
    In traditional Roman numbers *as I was taught them*, IXXCCC is a syntax
    error.
     
    Keith Thompson, Aug 30, 2013
    #43
  4. James Harris

    James Kuyper Guest

    No, just didn't feel it was worth commenting on.
     
    James Kuyper, Aug 30, 2013
    #44
  5. 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
     
    Stephen Sprunk, Aug 30, 2013
    #45
  6. James Harris

    Eric Sosman Guest

    Numerless times.
     
    Eric Sosman, Aug 30, 2013
    #46
  7. Numberous times?

    S
     
    Stephen Sprunk, Aug 30, 2013
    #47
  8. Ah, I was looking at the CCCXXI in the example, not the 123. I didn't
    notice the example wasn't self-consistent.

    S
     
    Stephen Sprunk, Sep 2, 2013
    #48
  9. Certainly no more than one was needed, and I don't recall if ANSI was
    (then) paranoid about marking. IBM definitely was, FWIW.
    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.
     
    David Thompson, Sep 4, 2013
    #49
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.