Re: Long in 16-bits microcontroller?

Discussion in 'C Programming' started by James Kuyper, Aug 6, 2013.

  1. James Kuyper

    James Kuyper Guest

    On 08/06/2013 12:44 PM, Christiano wrote:
    > In the 16-bit microcontrollers, when using long, the data will have
    > at least 32 bits. As the 16-bit processor can accomplish this? The
    > compiler creates an abstract data type to manipulate 32-bit using
    > their native 16-bit?


    A fully conforming implementation of C90 must have 32-bit signed and
    unsigned integer types; a fully conforming implementation of C99 must
    also have 64-bit types. That gives implementations on processors with
    fewer than 32 bits two options: emulate the larger types using native
    operations, or fail to conform. I gather that both options are in
    common use. You'll have to ask about a specific implementation in order
    to get a specific answer. Which microcontroller are you thinking of?
     
    James Kuyper, Aug 6, 2013
    #1
    1. Advertising

  2. James Kuyper

    James Kuyper Guest

    On 08/06/2013 12:59 PM, James Kuyper wrote:
    > On 08/06/2013 12:44 PM, Christiano wrote:
    >> In the 16-bit microcontrollers, when using long, the data will have
    >> at least 32 bits. As the 16-bit processor can accomplish this? The
    >> compiler creates an abstract data type to manipulate 32-bit using
    >> their native 16-bit?

    >
    > A fully conforming implementation of C90 must have 32-bit signed and
    > unsigned integer types;


    That should be "signed and unsigned types with at least 32 bits". You
    used "at least" - I should have remembered to do the same.
     
    James Kuyper, Aug 6, 2013
    #2
    1. Advertising

  3. On Tuesday, August 6, 2013 6:13:05 PM UTC+1, Christiano wrote:
    > On Tuesday, August 6, 2013 2:00:59 PM UTC-3, James Kuyper wrote:
    >
    > When Andreas says: "our current CCSv4 for MSP430 unfortunately does not
    > support 64-bit math;"
    >
    > This means that the compiler has no algorithms that make calculations
    > of numbers of 64-bit numbers using 16 bit, correct?
    >

    Yes.
    You can implement arithmetic of any precision, but it's so slow that usually
    there's not much point. Integers are almost always used to count and index
    things in memory, rarely for other purposes, so there's seldom much need for
    a 64 bit type on a machine with only 64,000 bytes of memory.
     
    Malcolm McLean, Aug 6, 2013
    #3
  4. (Gordon Burditt) writes:
    > Christiano <> writes:

    [attribution restored]
    >> The microcontroller is the MSP430 (Texas Instruments).
    >> Understood, then the compiler emulates. Therefore the link below:
    >> http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/32160.aspx
    >> When Andreas says: "our current CCSv4 for MSP430 unfortunately does not support 64-bit math;"

    >
    > There's no definition of "math" or "math functions" in the C standard.


    "Math" is an ordinary English word which can be presumed to have its
    usual meaning.

    "Math functions" are defined in the section of the standard that
    describes <math.h>.

    [...]

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Working, but not speaking, for JetHead Development, Inc.
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Aug 7, 2013
    #4
  5. James Kuyper

    Phil Carmody Guest

    Keith Thompson <> writes:
    > (Gordon Burditt) writes:
    > > Christiano <> writes:

    > [attribution restored]
    > >> The microcontroller is the MSP430 (Texas Instruments).
    > >> Understood, then the compiler emulates. Therefore the link below:
    > >> http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/32160.aspx
    > >> When Andreas says: "our current CCSv4 for MSP430 unfortunately does not support 64-bit math;"

    > >
    > > There's no definition of "math" or "math functions" in the C standard.

    >
    > "Math" is an ordinary English word which can be presumed to have its
    > usual meaning.


    The English would say it's an ugly Americanism; we like our trailing
    's', even when the word is contracted.

    However, indeed, the C standard does not need to contain an ordinary
    dictionary.

    Phil
    --
    If "law-abiding citizens have nothing to fear" from privacy-invading
    technologies and policies, then law-abiding governments should have
    nothing to fear from whistleblowers.
     
    Phil Carmody, Aug 8, 2013
    #5
  6. James Kuyper

    Ian Collins Guest

    Phil Carmody wrote:
    > Keith Thompson <> writes:
    >> (Gordon Burditt) writes:
    >>> Christiano <> writes:

    >> [attribution restored]
    >>>> The microcontroller is the MSP430 (Texas Instruments).
    >>>> Understood, then the compiler emulates. Therefore the link below:
    >>>> http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/32160.aspx
    >>>> When Andreas says: "our current CCSv4 for MSP430 unfortunately does not support 64-bit math;"
    >>>
    >>> There's no definition of "math" or "math functions" in the C standard.

    >>
    >> "Math" is an ordinary English word which can be presumed to have its
    >> usual meaning.

    >
    > The English would say it's an ugly Americanism; we like our trailing
    > 's', even when the word is contracted.


    Just about everyone in this distant outpost of the colonies would agree
    with then!

    --
    Ian Collins
     
    Ian Collins, Aug 8, 2013
    #6
  7. James Kuyper

    James Kuyper Guest

    On 08/08/2013 02:49 AM, Phil Carmody wrote:
    > Keith Thompson <> writes:
    >> (Gordon Burditt) writes:

    ....
    >>> There's no definition of "math" or "math functions" in the C standard.

    >>
    >> "Math" is an ordinary English word which can be presumed to have its
    >> usual meaning.

    >
    > The English would say it's an ugly Americanism; we like our trailing
    > 's', even when the word is contracted.


    C was originally created in the US, and K&R was written in the US
    dialect of English. The standard started out as an ANSI standard, and
    was therefore also written in that dialect. So that's why its <math.h>,
    not <maths.h>. While ISO is an international organization, I believe
    that the C standard is still written in that dialect - I don't remember
    noticing any Briticisms, though that doesn't mean there aren't any.

    As an international standard, it seems to me that it should be available
    in other languages, but I don't remember anyone ever mentioning an
    official translation into any other language. Is there one? I get the
    impression that the committees barely have enough resources to maintain
    it in a single dialect of a single language.
    --
    James Kuyper
     
    James Kuyper, Aug 8, 2013
    #7
  8. James Kuyper

    Tim Rentsch Guest

    Phil Carmody <> writes:

    > Keith Thompson <> writes:
    >> (Gordon Burditt) writes:
    >> > Christiano <> writes:

    >> [attribution restored]
    >> >> The microcontroller is the MSP430 (Texas Instruments).
    >> >> Understood, then the compiler emulates. Therefore the link below:
    >> >> http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/32160.aspx
    >> >> When Andreas says: "our current CCSv4 for MSP430 unfortunately does not support 64-bit math;"
    >> >
    >> > There's no definition of "math" or "math functions" in the C standard.

    >>
    >> "Math" is an ordinary English word which can be presumed to have its
    >> usual meaning.

    >
    > The English would say it's an ugly Americanism; we like our trailing
    > 's', even when the word is contracted.


    The word 'math' in 'math functions' or 'math library functions' is
    a shortening of 'mathematical', an adjective, not 'mathematics', a
    noun. So 'math functions' seems right even for those who prefer
    'maths' for 'mathematics'. (Disclaimer: I know very little about
    usage in non-American English.)
     
    Tim Rentsch, Aug 8, 2013
    #8
  9. James Kuyper

    Ian Collins Guest

    Robert Wessel wrote:
    > On Thu, 08 Aug 2013 09:01:03 -0400, James Kuyper
    > <> wrote:
    >>
    >> As an international standard, it seems to me that it should be available
    >> in other languages, but I don't remember anyone ever mentioning an
    >> official translation into any other language. Is there one? I get the
    >> impression that the committees barely have enough resources to maintain
    >> it in a single dialect of a single language.

    >
    >
    > Having more than one version of an authoritative document can be an
    > issue. There have been cases with international agreements where
    > authoritative versions* in different language for an agreement
    > differed. The Italo-Abyssian war of 1896 was at least partially
    > caused by such a problem.


    Anyone living here in New Zealand where our founding document is
    bilingual and the two versions differ in their interpretations would
    certainly agree!

    --
    Ian Collins
     
    Ian Collins, Aug 9, 2013
    #9
  10. James Kuyper

    James Kuyper Guest

    On 08/09/2013 02:33 AM, Robert Wessel wrote:
    ....
    > Having more than one version of an authoritative document can be an
    > issue. There have been cases with international agreements where
    > authoritative versions* in different language for an agreement
    > differed. The Italo-Abyssian war of 1896 was at least partially
    > caused by such a problem.
    >
    > So the "officialness" of a translation is problematic. The committee
    > could produce a translation, and then say that only the English
    > version is authoritative, ...


    I'm familiar with that issue, and I would expect that if the committee
    did produce the standard in multiple languages, it would identify one
    particular language as the authoritative one - presumably the English
    one, given the history of C. What I was wondering about was the fact
    that I'd heard nothing about any such versions. I'm a little surprised
    at the idea that ISO would be comfortable about producing an
    international standard in only one language. It was perfectly reasonable
    when it was only an ANSI standard, but as soon it became an ISO
    standard, I would have expected it to be governed by an ISO requirement
    that it be officially translated into at least a few other languages.
    --
    James Kuyper
     
    James Kuyper, Aug 9, 2013
    #10
  11. James Kuyper

    Les Cargill Guest

    James Kuyper wrote:
    > On 08/09/2013 02:33 AM, Robert Wessel wrote:
    > ...
    >> Having more than one version of an authoritative document can be an
    >> issue. There have been cases with international agreements where
    >> authoritative versions* in different language for an agreement
    >> differed. The Italo-Abyssian war of 1896 was at least partially
    >> caused by such a problem.
    >>
    >> So the "officialness" of a translation is problematic. The committee
    >> could produce a translation, and then say that only the English
    >> version is authoritative, ...

    >
    > I'm familiar with that issue, and I would expect that if the committee
    > did produce the standard in multiple languages, it would identify one
    > particular language as the authoritative one - presumably the English
    > one, given the history of C. What I was wondering about was the fact
    > that I'd heard nothing about any such versions. I'm a little surprised
    > at the idea that ISO would be comfortable about producing an
    > international standard in only one language.


    Why this might be seems abundantly obvious. It simply means that in any
    disagreement, the disagreement is an artifact of translation and
    the English version is Canon.

    > It was perfectly reasonable
    > when it was only an ANSI standard, but as soon it became an ISO
    > standard, I would have expected it to be governed by an ISO requirement
    > that it be officially translated into at least a few other languages.
    >


    Franky Four Fingers: So the Biblical scholars mis-translated the Hebrew
    word for "young woman" into the Greek word for "virgin," which was a
    pretty easy mistake to make, since there is only a subtle difference in
    the spelling. But back then it was the "virgin" that caught people's
    attention. It's not every day a virgin conceives and bears a son. So
    you keep that for a couple of hundred years, and the next thing you
    know, you have the Holy Catholic church.

    (NSFW link)

    http://www.imdb.com/title/tt0208092/quotes

    --
    Les Cargill
     
    Les Cargill, Aug 9, 2013
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    749
    Eric Sosman
    Jul 8, 2003
  2. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,247
    Peter Shaggy Haywood
    Sep 20, 2005
  3. Digital Puer

    extracting front bits from an unsigned long long?

    Digital Puer, Nov 11, 2005, in forum: C Programming
    Replies:
    36
    Views:
    1,381
    Mark McIntyre
    Nov 13, 2005
  4. krunalb
    Replies:
    10
    Views:
    932
    Kenneth Brody
    Jan 23, 2007
  5. glen herrmannsfeldt

    Re: Long in 16-bits microcontroller?

    glen herrmannsfeldt, Aug 7, 2013, in forum: C Programming
    Replies:
    0
    Views:
    193
    glen herrmannsfeldt
    Aug 7, 2013
Loading...

Share This Page