Minimum sizes of integral and floating point types

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ioannis Vranos

    Minimum sizes of integral and floating point types

    Is there any mentioning in the standard of the number of bits of the
    various built in types, apart from char/signed char/unsigned char types?
    Or only about the minimum value ranges of them?
  • Victor Bazarov

    #2
    Re: Minimum sizes of integral and floating point types

    Ioannis Vranos wrote:
    Is there any mentioning in the standard of the number of bits of the
    various built in types, apart from char/signed char/unsigned char
    types? Or only about the minimum value ranges of them?
    It's actually in the C Standard. C++ Standard inherits those.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    • Ioannis Vranos

      #3
      Re: Minimum sizes of integral and floating point types

      Victor Bazarov wrote:
      Ioannis Vranos wrote:
      >Is there any mentioning in the standard of the number of bits of the
      >various built in types, apart from char/signed char/unsigned char
      >types? Or only about the minimum value ranges of them?
      >
      It's actually in the C Standard. C++ Standard inherits those.

      Yes, I knew that. Anyone with something more specific?

      Comment

      • Jerry Coffin

        #4
        Re: Minimum sizes of integral and floating point types

        In article <fqv80t$2j9o$1@ ulysses.noc.ntu a.gr>,
        ivranos@nospam. no.spamfreemail .gr says...
        Victor Bazarov wrote:
        Ioannis Vranos wrote:
        Is there any mentioning in the standard of the number of bits of the
        various built in types, apart from char/signed char/unsigned char
        types? Or only about the minimum value ranges of them?
        It's actually in the C Standard. C++ Standard inherits those.
        >
        >
        Yes, I knew that. Anyone with something more specific?
        Section 5.2.4.2

        --
        Later,
        Jerry.

        The universe is a figment of its own imagination.

        Comment

        • Ian Collins

          #5
          Re: Minimum sizes of integral and floating point types

          Ioannis Vranos wrote:
          Victor Bazarov wrote:
          >Ioannis Vranos wrote:
          >>Is there any mentioning in the standard of the number of bits of the
          >>various built in types, apart from char/signed char/unsigned char
          >>types? Or only about the minimum value ranges of them?
          >>
          >It's actually in the C Standard. C++ Standard inherits those.
          >
          Yes, I knew that. Anyone with something more specific?
          You've already asked on c.l.c, why ask again here?

          --
          Ian Collins.

          Comment

          • Ioannis Vranos

            #6
            Re: Minimum sizes of integral and floating point types

            Jerry Coffin wrote:
            In article <fqv80t$2j9o$1@ ulysses.noc.ntu a.gr>,
            ivranos@nospam. no.spamfreemail .gr says...
            >Victor Bazarov wrote:
            >>Ioannis Vranos wrote:
            >>>Is there any mentioning in the standard of the number of bits of the
            >>>various built in types, apart from char/signed char/unsigned char
            >>>types? Or only about the minimum value ranges of them?
            >>It's actually in the C Standard. C++ Standard inherits those.
            >>
            >Yes, I knew that. Anyone with something more specific?
            >
            Section 5.2.4.2

            In C++03, section 5.2.4 is about "Pseudo destructor call". Nothing
            relevant ro my question there.

            Comment

            • Ioannis Vranos

              #7
              Re: Minimum sizes of integral and floating point types

              Ian Collins wrote:
              Ioannis Vranos wrote:
              >Victor Bazarov wrote:
              >>Ioannis Vranos wrote:
              >>>Is there any mentioning in the standard of the number of bits of the
              >>>various built in types, apart from char/signed char/unsigned char
              >>>types? Or only about the minimum value ranges of them?
              >>It's actually in the C Standard. C++ Standard inherits those.
              >Yes, I knew that. Anyone with something more specific?
              >
              You've already asked on c.l.c, why ask again here?

              Because I am interested in both C95 and C++03.

              Comment

              • Ian Collins

                #8
                Re: Minimum sizes of integral and floating point types

                Ioannis Vranos wrote:
                Ian Collins wrote:
                >Ioannis Vranos wrote:
                >>Victor Bazarov wrote:
                >>>Ioannis Vranos wrote:
                >>>>Is there any mentioning in the standard of the number of bits of the
                >>>>various built in types, apart from char/signed char/unsigned char
                >>>>types? Or only about the minimum value ranges of them?
                >>>It's actually in the C Standard. C++ Standard inherits those.
                >>Yes, I knew that. Anyone with something more specific?
                >>
                >You've already asked on c.l.c, why ask again here?
                >
                >
                Because I am interested in both C95 and C++03.
                C++ inherits this from C. The reference Jerry gave you was from the C
                standard.

                --
                Ian Collins.

                Comment

                • Jerry Coffin

                  #9
                  Re: Minimum sizes of integral and floating point types

                  In article <fqvgtd$2kp$1@u lysses.noc.ntua .gr>,
                  ivranos@nospam. no.spamfreemail .gr says...
                  Jerry Coffin wrote:
                  In article <fqv80t$2j9o$1@ ulysses.noc.ntu a.gr>,
                  ivranos@nospam. no.spamfreemail .gr says...
                  Victor Bazarov wrote:
                  >Ioannis Vranos wrote:
                  >>Is there any mentioning in the standard of the number of bits of the
                  >>various built in types, apart from char/signed char/unsigned char
                  >>types? Or only about the minimum value ranges of them?
                  >It's actually in the C Standard. C++ Standard inherits those.
                  >
                  Yes, I knew that. Anyone with something more specific?
                  Section 5.2.4.2
                  >
                  >
                  In C++03, section 5.2.4 is about "Pseudo destructor call". Nothing
                  relevant ro my question there.
                  As noted above, the C standard is what's relevant here, so you need to
                  look at section 5.2.4.2 of the C standard (the C99 standard, to be
                  specific).

                  --
                  Later,
                  Jerry.

                  The universe is a figment of its own imagination.

                  Comment

                  • James Kanze

                    #10
                    Re: Minimum sizes of integral and floating point types

                    On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam .no.spamfreemai l.gr>
                    wrote:
                    Is there any mentioning in the standard of the number of bits
                    of the various built in types, apart from char/signed
                    char/unsigned char types? Or only about the minimum value
                    ranges of them?
                    No. But for integral types, the standard does impose a pure
                    binary representation, so the minimum value ranges do impose a
                    minimum number of bits. For floating point types, the standard
                    imposes minimum ranges and precision, which also imposes a
                    minimum amount of information present---if a "bit" is a binary
                    digit, this also imposes a certain minimum number of bits.

                    There's also a requirement that sizeof be an integral type, and
                    that you can examine all of the bits of an object (regardless of
                    its type) using unsigned char. Independently of the requirement
                    that CHAR_BIT be at least 8, this would forbid the usual PDP-10
                    organization of 36 bit words, with 5 7 bit bytes per word (and
                    one unused bit). It doesn't require that all bits participate
                    in the value representation, however---on a Unisys MCP, for
                    example, you can see all 48 bits of an int accessing it as an
                    array of [6] unsigned char, but only 40 participate in the value
                    representation, and only 39 can be accessed using unsigned int
                    with shift and masking operations.

                    --
                    James Kanze (GABI Software) email:james.kan ze@gmail.com
                    Conseils en informatique orientée objet/
                    Beratung in objektorientier ter Datenverarbeitu ng
                    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

                    Comment

                    • Ioannis Vranos

                      #11
                      Re: Minimum sizes of integral and floating point types

                      James Kanze wrote:
                      On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam .no.spamfreemai l.gr>
                      wrote:
                      >Is there any mentioning in the standard of the number of bits
                      >of the various built in types, apart from char/signed
                      >char/unsigned char types? Or only about the minimum value
                      >ranges of them?
                      >
                      No. But for integral types, the standard does impose a pure
                      binary representation, so the minimum value ranges do impose a
                      minimum number of bits.

                      Do you mean that all integer types, signed and unsigned, are required to
                      not have padding bits?

                      Comment

                      • =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=

                        #12
                        Re: Minimum sizes of integral and floating point types

                        On 2008-03-09 13:33, Ioannis Vranos wrote:
                        James Kanze wrote:
                        >On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam .no.spamfreemai l.gr>
                        >wrote:
                        >>Is there any mentioning in the standard of the number of bits
                        >>of the various built in types, apart from char/signed
                        >>char/unsigned char types? Or only about the minimum value
                        >>ranges of them?
                        >>
                        >No. But for integral types, the standard does impose a pure
                        >binary representation, so the minimum value ranges do impose a
                        >minimum number of bits.
                        >
                        >
                        Do you mean that all integer types, signed and unsigned, are required to
                        not have padding bits?
                        Since the standard does impose a pure binary representation and a
                        minimal interval of values that the integer should be able to store
                        there is an implicit requirement on the minimum size (in bits) of the
                        integer types (the minimal number of bits required to store values in
                        those intervals).

                        --
                        Erik Wikström

                        Comment

                        • Jack Klein

                          #13
                          Re: Minimum sizes of integral and floating point types

                          On Sun, 09 Mar 2008 14:33:53 +0200, Ioannis Vranos
                          <ivranos@nospam .no.spamfreemai l.grwrote in comp.lang.c++:
                          James Kanze wrote:
                          On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam .no.spamfreemai l.gr>
                          wrote:
                          Is there any mentioning in the standard of the number of bits
                          of the various built in types, apart from char/signed
                          char/unsigned char types? Or only about the minimum value
                          ranges of them?
                          No. But for integral types, the standard does impose a pure
                          binary representation, so the minimum value ranges do impose a
                          minimum number of bits.
                          >
                          >
                          Do you mean that all integer types, signed and unsigned, are required to
                          not have padding bits?
                          No, that is only true of unsigned char (in C), and all the character
                          types in C++.

                          It is also true of the exact-width integer types, if defined, in C99,
                          not yet but soon to be part of the next C++ standard. They must have
                          no padding bits and use 2's complement representation for negative
                          values in the signed types.

                          --
                          Jack Klein
                          Home: http://JK-Technology.Com
                          FAQs for
                          comp.lang.c http://c-faq.com/
                          comp.lang.c++ http://www.parashift.com/c++-faq-lite/
                          alt.comp.lang.l earn.c-c++

                          Comment

                          • James Kanze

                            #14
                            Re: Minimum sizes of integral and floating point types

                            On Mar 9, 1:33 pm, Ioannis Vranos <ivra...@nospam .no.spamfreemai l.gr>
                            wrote:
                            James Kanze wrote:
                            On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam .no.spamfreemai l.gr>
                            wrote:
                            Is there any mentioning in the standard of the number of bits
                            of the various built in types, apart from char/signed
                            char/unsigned char types? Or only about the minimum value
                            ranges of them?
                            No. But for integral types, the standard does impose a pure
                            binary representation, so the minimum value ranges do impose a
                            minimum number of bits.
                            Do you mean that all integer types, signed and unsigned, are
                            required to not have padding bits?
                            No, but the value bits must use a binary representation. (The C
                            standard says explicitly that the negative representation must
                            be one of 2's complement, 1's complement or signed magnitude.
                            C++ tries to say more or less the same thing in more general
                            terms.)

                            --
                            James Kanze (GABI Software) email:james.kan ze@gmail.com
                            Conseils en informatique orientée objet/
                            Beratung in objektorientier ter Datenverarbeitu ng
                            9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

                            Comment

                            Working...