Machine precision

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack Klein

    #16
    Re: Machine precision

    On Mon, 20 Oct 2003 20:19:31 +0200, "Patrick Frankenberger"
    <p.frankenberge r@gmx.net> wrote in comp.lang.c++:
    [color=blue]
    >
    > "Keith S." wrote:[color=green]
    > > P.J. Plauger wrote:
    > >[color=darkred]
    > > > No, the distribution is extremely *non* uniform, with values much more[/color][/color]
    > densely[color=green][color=darkred]
    > > > packed close to zero.[/color]
    > >
    > > This has me interested, since I would have assumed the same as the
    > > previous poster, i.e. that values would be evenly spaced according
    > > to the smallest value (DBL_EPSILON).[/color]
    >
    > A floating-point number is: a*2^(b-offset)
    > a is a signed integer and b is an unsigned integer.
    >
    > HTH,
    > Patrick[/color]

    ....on some platforms, perhaps all of those that you are familiar with.
    The C++ language standard deliberately does not specify the
    implementation details of the floating point types, and some are quite
    different from the model you describe.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    alt.comp.lang.l earn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

    Comment

    • Keith S.

      #17
      Re: Machine precision

      Ron Natalie wrote:
      [color=blue]
      > I wasn't trying to be impolite, just a bit terser then usual. doubles aren't
      > just fractions, they shift. I thought the above would be enough of a hint
      > if you thought about it.[/color]

      OK, fair enough. I obviously had not thought about it enough ;)

      - Keith

      Comment

      • Frank Schmitt

        #18
        Re: Machine precision

        "osmium" <r124c4u102@com cast.net> writes:
        [color=blue]
        > Ron Natalie wrote:
        >[color=green][color=darkred]
        > > > > No, the distribution is extremely *non* uniform, with values much more[/color][/color]
        > densely[color=green][color=darkred]
        > > > > packed close to zero.
        > > >
        > > > This has me interested, since I would have assumed the same as the
        > > > previous poster, i.e. that values would be evenly spaced according
        > > > to the smallest value (DBL_EPSILON).
        > > >
        > > > Anyone have a simple explanation of why?
        > > >[/color]
        > > FLOATING POINT. Do you understand mantissa and exponent?[/color]
        >
        > In the dark ages that thing was called, mistakenly, mantissa. It has
        > nothing to do with the mantissa as in logarithms. Many (most?) people are
        > now using a much less tortured term "significan d".[/color]

        Excuse me, but that's nonsense. Everybody I know uses the terms mantissa and
        exponent.
        Just because you or anybody else doesn't like mantissa doesn't make it wrong.

        regards
        frank

        --
        Frank Schmitt
        4SC AG phone: +49 89 700763-0
        e-mail: frankNO DOT SPAMschmitt AT 4sc DOT com

        Comment

        • Keith S.

          #19
          Re: Machine precision

          Frank Schmitt wrote:
          [color=blue]
          > Excuse me, but that's nonsense. Everybody I know uses the terms mantissa and
          > exponent.
          > Just because you or anybody else doesn't like mantissa doesn't make it wrong.[/color]

          Acording to Knuth "it is an abuse of terminology to call the fraction
          part a mantissa, since that term has quite a different meaning in
          connection with logarithms".

          But this is getting a bit pedantic...

          - Keith

          Comment

          • Gary Labowitz

            #20
            Re: Machine precision

            "Keith S." <false@ntlworld .com> wrote in message
            news:bn3c80$sqd cc$1@ID-169434.news.uni-berlin.de...[color=blue]
            > Frank Schmitt wrote:
            >[color=green]
            > > Excuse me, but that's nonsense. Everybody I know uses the terms mantissa[/color][/color]
            and[color=blue][color=green]
            > > exponent.
            > > Just because you or anybody else doesn't like mantissa doesn't make it[/color][/color]
            wrong.[color=blue]
            >
            > Acording to Knuth "it is an abuse of terminology to call the fraction
            > part a mantissa, since that term has quite a different meaning in
            > connection with logarithms".
            >
            > But this is getting a bit pedantic...[/color]

            Hmm... sounds good ... but is it?

            According to good ol' pedantic Webster:

            Main Entry: pe·dan·tic
            Pronunciation: pi-'dan-tik
            Function: adjective
            Date: circa 1600
            1 : of, relating to, or being a pedant
            2 : narrowly, stodgily, and often ostentatiously learned

            Main Entry: man·tis·sa
            Pronunciation: man-'ti-s&
            Function: noun
            Etymology: Latin mantisa, mantissa makeweight, from Etruscan
            Date: circa 1847
            : the part of a logarithm to the right of the decimal point

            I'd say that Knuth, rather than being pedantic, was correct.

            Main Entry: correct
            Function: adjective
            Etymology: Middle English, corrected, from Latin correctus, from past
            participle of corrigere
            Date: 1676
            1 : conforming to an approved or conventional standard
            2 : conforming to or agreeing with fact, logic, or known truth
            3 : conforming to a set figure <enclosed the correct return postage>

            Nevertheless, we still can USE the word mantissa for the numeric value of
            floating-point encodings.
            (IEEE standard calls it "the fraction.")

            "When I use a word," Humpty Dumpty said in rather a scornful tone, "it means
            just what I choose it to mean - neither more nor less."
            Lewis Carroll
            --
            Gary


            Comment

            • Ron Natalie

              #21
              Re: Machine precision


              "Keith S." <false@ntlworld .com> wrote in message news:bn3c80$sqd cc$1@ID-169434.news.uni-berlin.de...[color=blue]
              > Frank Schmitt wrote:
              >[color=green]
              > > Excuse me, but that's nonsense. Everybody I know uses the terms mantissa and
              > > exponent.
              > > Just because you or anybody else doesn't like mantissa doesn't make it wrong.[/color]
              >
              > Acording to Knuth "it is an abuse of terminology to call the fraction
              > part a mantissa, since that term has quite a different meaning in
              > connection with logarithms".[/color]

              Lots of words have different meanings in different contexts.
              Knuth's no paragon of linguistic sanity. He can't even get typography right.



              Comment

              • osmium

                #22
                Re: Machine precision

                Keith S. writes:
                [color=blue]
                > Acording to Knuth "it is an abuse of terminology to call the fraction
                > part a mantissa, since that term has quite a different meaning in
                > connection with logarithms".
                >
                > But this is getting a bit pedantic...[/color]

                But it is not pedantic. Misappropriatin g and misusing a word from another
                field can be disastrous, as it is in this case. You show me a hundred
                programmers and I will show you a significant number who think it really
                *IS* a mantissa as in logarithms. Which is the very reason for this
                sub-thread.


                Comment

                • Ron Natalie

                  #23
                  Re: Machine precision


                  "osmium" <r124c4u102@com cast.net> wrote in message news:bn3gci$slo hd$1@ID-179017.news.uni-berlin.de...[color=blue]
                  > Keith S. writes:
                  >[color=green]
                  > > Acording to Knuth "it is an abuse of terminology to call the fraction
                  > > part a mantissa, since that term has quite a different meaning in
                  > > connection with logarithms".
                  > >
                  > > But this is getting a bit pedantic...[/color]
                  >
                  > But it is not pedantic. Misappropriatin g and misusing a word from another
                  > field can be disastrous, as it is in this case.[/color]

                  Show me how this is disasterous. It's not just a case of me "stealing the word."
                  It was done long before I got to it. It's no different than dozens of other terms
                  in a new science like computers.
                  [color=blue]
                  > You show me a hundred
                  > programmers and I will show you a significant number who think it really
                  > *IS* a mantissa as in logarithms.[/color]

                  Give me a break. I doubt that. Frankly, most programmers these days
                  have no clue what a mantissa means with respect to logarithms at all.
                  Those of us old farts remember using log charts where you'd have to
                  seperate the whole and fractional parts of the logarithm, but those went
                  the way of the dodo 25 years ago when the inexpensive scientific calculator
                  came out. My log charts and my slide rule haven't seen the light of day in
                  decades.

                  Those who know what a logaritm mantissa don't have to think to hard to realize
                  it just means the fractional part of the value, as opposed to athe fractional part of
                  the exponent.


                  Comment

                  • osmium

                    #24
                    Re: Machine precision

                    Ron Natalie writes:
                    [color=blue]
                    > "osmium" <r124c4u102@com cast.net> wrote in message[/color]
                    news:bn3gci$slo hd$1@ID-179017.news.uni-berlin.de...[color=blue][color=green]
                    > > Keith S. writes:
                    > >[color=darkred]
                    > > > Acording to Knuth "it is an abuse of terminology to call the fraction
                    > > > part a mantissa, since that term has quite a different meaning in
                    > > > connection with logarithms".
                    > > >
                    > > > But this is getting a bit pedantic...[/color]
                    > >
                    > > But it is not pedantic. Misappropriatin g and misusing a word from[/color][/color]
                    another[color=blue][color=green]
                    > > field can be disastrous, as it is in this case.[/color]
                    >
                    > Show me how this is disasterous. It's not just a case of me "stealing[/color]
                    the word."[color=blue]
                    > It was done long before I got to it. It's no different than dozens of[/color]
                    other terms[color=blue]
                    > in a new science like computers.
                    >[color=green]
                    > > You show me a hundred
                    > > programmers and I will show you a significant number who think it really
                    > > *IS* a mantissa as in logarithms.[/color]
                    >
                    > Give me a break. I doubt that. Frankly, most programmers these days
                    > have no clue what a mantissa means with respect to logarithms at all.
                    > Those of us old farts remember using log charts where you'd have to
                    > seperate the whole and fractional parts of the logarithm, but those went
                    > the way of the dodo 25 years ago when the inexpensive scientific[/color]
                    calculator[color=blue]
                    > came out. My log charts and my slide rule haven't seen the light of day[/color]
                    in[color=blue]
                    > decades.
                    >
                    > Those who know what a logaritm mantissa don't have to think to hard to[/color]
                    realize[color=blue]
                    > it just means the fractional part of the value, as opposed to athe[/color]
                    fractional part of[color=blue]
                    > the exponent.[/color]

                    Your post is there. Res ipsa loquitur.


                    Comment

                    • Philipp

                      #25
                      Re: Machine precision

                      Thank you all for your answers.
                      The proposed article "What every computer scientist should know about
                      floating-point arithmetic" is definitely worth reading.

                      I'm using gcc 3.3 or Metrowerks compiler and am surprised that sizeof(int) =
                      sizeof(long) = 4 (I thought long was bigger than int) and that sizeof(long
                      double) = 12 (with gcc), and sizeof(long double) = 8 (with Metrowerks) are
                      different... Hmm need to use some caution when doing precise calculation
                      then...

                      Anyway that's not the point here :-) Best regards
                      Phil



                      Comment

                      Working...