Floating point bug?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D'Arcy J.M. Cain

    #61
    Re: How about adding rational fraction to Python?

    On Tue, 26 Feb 2008 09:01:57 -0800
    Jeff Schwab <jeff@schwabcen ter.comwrote:
    Or Jo thinks // is a typo, and helpfully "fixes" it.
    Exactly. "Programmer s" who use a language without learning it are apt
    to do anything.

    --
    D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
    http://www.druid.net/darcy/ | and a sheep voting on
    +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

    Comment

    • Steve Holden

      #62
      Re: How about adding rational fraction to Python?

      D'Arcy J.M. Cain wrote:
      On Tue, 26 Feb 2008 06:45:45 -0800 (PST)
      Carl Banks <pavlovevidence @gmail.comwrote :
      >On Feb 26, 9:29 am, "D'Arcy J.M. Cain" <da...@druid.ne twrote:
      >>If 3/4 ever returned 0.75 in any language I would drop that language.
      >Have fun dropping Python, then, chief. Integer division with / is
      >already deprecated, can be disabled ever since Python 2.4, and will be
      >wholly removed in Python 3.0.
      >
      I have not been following Python development that closely lately so I
      was not aware of that. I guess I won't be going to Python 3 then. It's
      great that Python wants to attract young, new programmers. Too bad
      about us old farts I guess.
      >
      How soon before 2.x is completely deprecated and I have to become a
      Walmart greeter?
      >
      I'm guessing at least four years: 2.6 will com out at the same time as
      3.1, and there will definitely be a 2.7 release. After that you may
      indeed be working for Walmart, though do remember that 1.5.2 is still a
      perfectly viable language ten years after its release.

      regards
      Steve
      --
      Steve Holden +1 571 484 6266 +1 800 494 3119
      Holden Web LLC http://www.holdenweb.com/

      Comment

      • Grant Edwards

        #63
        Re: How about adding rational fraction to Python?

        On 2008-02-26, Lie <Lie.1296@gmail .comwrote:
        >I'm in the camp that believes that 3/4 does indeed yield the integer 0,
        >but should be spelled 3//4 when that is the intention.
        >
        That's creepy for people that are new to programming and doesn't know
        how CPUs work and are used to general mathematics.
        I don't know where you went to grade school, but where I went,
        we learned about integer division long before we learned about
        floating point.
        That means most people.
        I guess it must depend on where you went to shool.
        As programming language are now more accessible to regular
        people without specialized Computer Science degree, it is a
        just natural trend that computer arithmetic must be done in an
        expectable manner as seen by those general population not by
        people who holds a CS degree.

        --
        Grant Edwards grante Yow! You were s'posed
        at to laugh!
        visi.com

        Comment

        • Jeff Schwab

          #64
          Re: How about adding rational fraction to Python?

          Grant Edwards wrote:
          I guess it must depend on where you went to shool.
          Temple Israel. You?

          Comment

          • Mensanator

            #65
            Re: How about adding rational fraction to Python?

            On Feb 26, 9:08 am, "D'Arcy J.M. Cain" <da...@druid.ne twrote:
            On Tue, 26 Feb 2008 06:45:45 -0800 (PST)
            >
            Carl Banks <pavlovevide... @gmail.comwrote :
            On Feb 26, 9:29 am, "D'Arcy J.M. Cain" <da...@druid.ne twrote:
            If 3/4 ever returned 0.75 in any language I would drop that language.
            >
            Have fun dropping Python, then, chief.  Integer division with / is
            already deprecated, can be disabled ever since Python 2.4, and will be
            wholly removed in Python 3.0.
            >
            I have not been following Python development that closely lately so I
            was not aware of that. I guess I won't be going to Python 3 then.  It's
            great that Python wants to attract young, new programmers.  Too bad
            about us old farts I guess.
            Why resign yourself to being old? Why not stay young and envigorated
            by learning the new features? How many times have you said "if I knew
            then what I know now...". Well, here's your chance. I'm looking
            forwards
            to it.
            >
            How soon before 2.x is completely deprecated and I have to become a
            Walmart greeter?
            Personally, I plan to drop Python if support for the gmpy module
            ever dries up. But I won't be a quitter, just have to start using
            C which will suck the life out of the room. But what else can I do?
            >
            --
            D'Arcy J.M. Cain <da...@druid.ne t        |  Democracy is threewolveshttp ://www.druid.net/darcy/               |  and a sheep voting on
            +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

            Comment

            • J. Cliff Dyer

              #66
              Re: How about adding rational fraction to Python?

              On Tue, 2008-02-26 at 10:08 -0500, D'Arcy J.M. Cain wrote:
              On Tue, 26 Feb 2008 06:45:45 -0800 (PST)
              Carl Banks <pavlovevidence @gmail.comwrote :
              On Feb 26, 9:29 am, "D'Arcy J.M. Cain" <da...@druid.ne twrote:
              If 3/4 ever returned 0.75 in any language I would drop that language.
              Have fun dropping Python, then, chief. Integer division with / is
              already deprecated, can be disabled ever since Python 2.4, and will be
              wholly removed in Python 3.0.
              >
              I have not been following Python development that closely lately so I
              was not aware of that. I guess I won't be going to Python 3 then. It's
              great that Python wants to attract young, new programmers. Too bad
              about us old farts I guess.
              >
              How soon before 2.x is completely deprecated and I have to become a
              Walmart greeter?

              Given your stated criteria (that int OP int == int), you should be a
              WalMart greeter now.
              >>a = 20000 * 20000
              >>b = 200000 * 200000
              >>type(a)
              <type 'int'>
              >>type(b)
              <type 'long'>

              That's true at least back to Python 2.3. But maybe you're just being
              melodramatic, and will actually adapt to this change as well as all the
              other changes that have occurred in the python language.





              Comment

              • D'Arcy J.M. Cain

                #67
                Re: How about adding rational fraction to Python?

                On Tue, 26 Feb 2008 13:39:38 -0500
                "J. Cliff Dyer" <jcd@sdf.lonest ar.orgwrote:
                >a = 20000 * 20000
                >b = 200000 * 200000
                >type(a)
                <type 'int'>
                >type(b)
                <type 'long'>
                A long int is still integral which is the crux of the issue.

                --
                D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
                http://www.druid.net/darcy/ | and a sheep voting on
                +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

                Comment

                • Grant Edwards

                  #68
                  Re: How about adding rational fraction to Python?

                  On 2008-02-26, Jeff Schwab <jeff@schwabcen ter.comwrote:
                  Grant Edwards wrote:
                  >
                  >I guess it must depend on where you went to shool.
                  >
                  Temple Israel. You?
                  Good one. :)

                  --
                  Grant Edwards grante Yow! Do you think the
                  at "Monkees" should get gas on
                  visi.com odd or even days?

                  Comment

                  • Grant Edwards

                    #69
                    Re: How about adding rational fraction to Python?

                    On 2008-02-26, Mensanator <mensanator@aol .comwrote:
                    >How soon before 2.x is completely deprecated and I have to become a
                    >Walmart greeter?
                    >
                    Personally, I plan to drop Python if support for the gmpy module
                    ever dries up. But I won't be a quitter, just have to start using
                    C which will suck the life out of the room. But what else can I do?
                    Fork?

                    --
                    Grant Edwards grante Yow! The entire CHINESE
                    at WOMEN'S VOLLEYBALL TEAM all
                    visi.com share ONE personality --
                    and have since BIRTH!!

                    Comment

                    • Torsten Bronger

                      #70
                      Re: How about adding rational fraction to Python?

                      Hallöchen!

                      Grant Edwards writes:
                      [...]
                      >
                      Nope. I would prefer that int OP int always produce an int.
                      And 2**-1?

                      Your formulation tries to suggest some sort of logical consequence
                      but in my opinion, it's still a mere matter of taste and habits. I
                      remember my first steps in C++ 12 years ago when I tried to
                      implement a couple of astronomical formulae, always getting false
                      results because C++ calculated 3/4=0.

                      I think the only real reason for people prefering int/int=int is
                      that computers can deal with inteters better than with floats,
                      resulting in int-only arithmetic in computer languages. However, I
                      don't consider this a particularly good reason.

                      Tschö,
                      Torsten.

                      --
                      Torsten Bronger, aquisgrana, europa vetus
                      Jabber ID: bronger@jabber. org
                      (See http://ime.webhop.org for further contact info.)

                      Comment

                      • Paul Rubin

                        #71
                        Re: How about adding rational fraction to Python?

                        "D'Arcy J.M. Cain" <darcy@druid.ne twrites:
                        Note, I use the word "natural" above. Natural is an opinion and that
                        happens to be mine.

                        Comment

                        • D'Arcy J.M. Cain

                          #72
                          Re: How about adding rational fraction to Python?

                          On 26 Feb 2008 12:53:48 -0800
                          Paul Rubin <"http://phr.cx"@NOSPAM. invalidwrote:
                          "D'Arcy J.M. Cain" <darcy@druid.ne twrites:
                          Note, I use the word "natural" above. Natural is an opinion and that
                          happens to be mine.
                          >
                          http://en.wikipedia.org/wiki/Natural_number
                          Recheck the context. I was talking about the natural result, not
                          natural numbers.

                          --
                          D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
                          http://www.druid.net/darcy/ | and a sheep voting on
                          +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

                          Comment

                          • Terry Reedy

                            #73
                            Re: How about adding rational fraction to Python?


                            "Arnaud Delobelle" <arnodel@google mail.comwrote in message
                            | >>3/5
                            | 0.5999999999999 9998

                            I think this either changed in 3.0a2 or may in upcoming releases.




                            Comment

                            • Paul Rubin

                              #74
                              Re: How about adding rational fraction to Python?

                              "D'Arcy J.M. Cain" <darcy@druid.ne twrites:
                              Recheck the context. I was talking about the natural result, not
                              natural numbers.
                              The natural result of doing arithmetic with natural numbers is more
                              natural numbers.

                              Comment

                              • Ross Ridge

                                #75
                                Re: How about adding rational fraction to Python?

                                Paul Rubin <http://phr.cx@NOSPAM.i nvalidwrote:"D'Arcy J.M. Cain" <darcy@druid.ne twrites:
                                Recheck the context. I was talking about the natural result, not
                                natural numbers.
                                Paul Rubin <http://phr.cx@NOSPAM.i nvalidwrote:
                                The natural result of doing arithmetic with natural numbers is more
                                natural numbers.
                                D'Arcy said nothing about natural numbers, and bringing them up adds
                                nothing to this discussion.

                                Ross Ridge

                                --
                                l/ // Ross Ridge -- The Great HTMU
                                [oo][oo] rridge@csclub.u waterloo.ca
                                -()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
                                db //

                                Comment

                                Working...