Loading ...
Sorry, an error occurred while loading the content.

Is this a floating point error?

Expand Messages
  • pugflop84
    Hi guys, After a lot of work, I got Python (2.2.1) to cross compile and work on the NSLU2, but there seems to be a problem. If I fire up the interpreter to do
    Message 1 of 5 , Jan 17, 2005
    • 0 Attachment
      Hi guys,

      After a lot of work, I got Python (2.2.1) to cross compile and work on
      the NSLU2, but there seems to be a problem.

      If I fire up the interpreter to do some basic math, integer addition,
      subtraction, multiplication, and division work fine. However, if I
      try an operation with decimal numbers, I get really, really weird
      answers. For example:

      2.2+2.2

      -3.9920578008051959

      2.2-2.2

      0.0 (correct)

      2.2-0.1

      1.1641532182693481e-10

      3*0.5

      -5.9880867011379451

      3/0.5

      -1.5029842500927193

      Do you think this is a floating point issue? Anyone else heard of
      this or know what to do?

      Thanks,
      Rob
    • Rod Whitby
      We would need to know which firmware you are running, which cross-compilation environment you are running, and which build system you are using. -- Rod
      Message 2 of 5 , Jan 17, 2005
      • 0 Attachment
        We would need to know which firmware you are running, which
        cross-compilation environment you are running, and which build system
        you are using.

        -- Rod

        On Mon, 17 Jan 2005 22:56:53 -0000, pugflop84 <pugflop@...> wrote:
        >
        > Hi guys,
        >
        > After a lot of work, I got Python (2.2.1) to cross compile and work on
        > the NSLU2, but there seems to be a problem.
        >
        > If I fire up the interpreter to do some basic math, integer addition,
        > subtraction, multiplication, and division work fine. However, if I
        > try an operation with decimal numbers, I get really, really weird
        > answers. For example:
        >
        > 2.2+2.2
        >
        > -3.9920578008051959
        >
        > 2.2-2.2
        >
        > 0.0 (correct)
        >
        > 2.2-0.1
        >
        > 1.1641532182693481e-10
        >
        > 3*0.5
        >
        > -5.9880867011379451
        >
        > 3/0.5
        >
        > -1.5029842500927193
        >
        > Do you think this is a floating point issue? Anyone else heard of
        > this or know what to do?
        >
        > Thanks,
        > Rob
        >
        >
        >
        >
        >
        > [ Moderator Note: All static information is slowly moving to the Wiki at
        > http://www.nslu2-linux.org ]
        >
        >
        > ________________________________
        > Yahoo! Groups Links
        > To visit your group on the web, go to:
        > http://groups.yahoo.com/group/nslu2-linux/
        >
        > To unsubscribe from this group, send an email to:
        > nslu2-linux-unsubscribe@yahoogroups.com
        >
        > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
      • pugflop84
        Hi. I m running Unslung 3.17, crosstool for cross compiling (armv5b-softfloat-linux), and the build system is an x86 Debian Sarge box. Thanks, Rob ... Wiki at
        Message 3 of 5 , Jan 18, 2005
        • 0 Attachment
          Hi.

          I'm running Unslung 3.17, crosstool for cross compiling
          (armv5b-softfloat-linux), and the build system is an x86 Debian Sarge box.

          Thanks,
          Rob

          --- In nslu2-linux@yahoogroups.com, Rod Whitby <list.yahoo@r...> wrote:
          > We would need to know which firmware you are running, which
          > cross-compilation environment you are running, and which build system
          > you are using.
          >
          > -- Rod
          >
          > On Mon, 17 Jan 2005 22:56:53 -0000, pugflop84 <pugflop@h...> wrote:
          > >
          > > Hi guys,
          > >
          > > After a lot of work, I got Python (2.2.1) to cross compile and work on
          > > the NSLU2, but there seems to be a problem.
          > >
          > > If I fire up the interpreter to do some basic math, integer addition,
          > > subtraction, multiplication, and division work fine. However, if I
          > > try an operation with decimal numbers, I get really, really weird
          > > answers. For example:
          > >
          > > 2.2+2.2
          > >
          > > -3.9920578008051959
          > >
          > > 2.2-2.2
          > >
          > > 0.0 (correct)
          > >
          > > 2.2-0.1
          > >
          > > 1.1641532182693481e-10
          > >
          > > 3*0.5
          > >
          > > -5.9880867011379451
          > >
          > > 3/0.5
          > >
          > > -1.5029842500927193
          > >
          > > Do you think this is a floating point issue? Anyone else heard of
          > > this or know what to do?
          > >
          > > Thanks,
          > > Rob
          > >
          > >
          > >
          > >
          > >
          > > [ Moderator Note: All static information is slowly moving to the
          Wiki at
          > > http://www.nslu2-linux.org ]
          > >
          > >
          > > ________________________________
          > > Yahoo! Groups Links
          > > To visit your group on the web, go to:
          > > http://groups.yahoo.com/group/nslu2-linux/
          > >
          > > To unsubscribe from this group, send an email to:
          > > nslu2-linux-unsubscribe@yahoogroups.com
          > >
          > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        • mrthreeplates
          Hi All, I am also getting floating point errors, but with PHP. I am also getting strange behavior from imagemagick (hangs when I try to create thumbnails or
          Message 4 of 5 , Jan 29, 2005
          • 0 Attachment
            Hi All,

            I am also getting floating point errors, but with PHP. I
            am also getting strange behavior from imagemagick (hangs when
            I try to create thumbnails or resize images).

            I'm hoping this problem will go away if I go to unslung 3.17, but
            judging by this post, I'm not sure. Any advice?

            Note that I get different errors with the two thttpd & php
            versions posted. I am using unslung 2.12.

            w/thttpd & php (11/23/04 version in Files area)

            floor 1.2: 2.2250717365114E-308
            round 1.2: 1.1125348072578E-308
            (int) 1.2: 0
            1/2: -0.99134635936935
            1: 1
            1.0: -1.9826927187387
            1.0 - 6.7: 1.5716050683068E-10

            w/thttpd & php 5.03: (12/27/04 version in Files area)

            floor 1.2: 2.2250717365114E-308
            round 1.2: 2.2250717365114E-308
            (int) 1.2: 1
            1/2: 0.5
            1: 1
            1.0: 1
            1.0 - 6.7: -5.7

            Obviously, the second one is better, but the fact that they
            are different is a bit of a puzzle.

            George

            --- In nslu2-linux@yahoogroups.com, "pugflop84" <pugflop@h...> wrote:
            >
            > Hi.
            >
            > I'm running Unslung 3.17, crosstool for cross compiling
            > (armv5b-softfloat-linux), and the build system is an x86 Debian
            Sarge box.
            >
            > Thanks,
            > Rob
            >
            > --- In nslu2-linux@yahoogroups.com, Rod Whitby <list.yahoo@r...> wrote:
            > > We would need to know which firmware you are running, which
            > > cross-compilation environment you are running, and which build system
            > > you are using.
            > >
            > > -- Rod
            > >
            > > On Mon, 17 Jan 2005 22:56:53 -0000, pugflop84 <pugflop@h...> wrote:
            > > >
            > > > Hi guys,
            > > >
            > > > After a lot of work, I got Python (2.2.1) to cross compile and
            work on
            > > > the NSLU2, but there seems to be a problem.
            > > >
            > > > If I fire up the interpreter to do some basic math, integer
            addition,
            > > > subtraction, multiplication, and division work fine. However, if I
            > > > try an operation with decimal numbers, I get really, really weird
            > > > answers. For example:
            > > >
            > > > 2.2+2.2
            > > >
            > > > -3.9920578008051959
            > > >
            > > > 2.2-2.2
            > > >
            > > > 0.0 (correct)
            > > >
            > > > 2.2-0.1
            > > >
            > > > 1.1641532182693481e-10
            > > >
            > > > 3*0.5
            > > >
            > > > -5.9880867011379451
            > > >
            > > > 3/0.5
            > > >
            > > > -1.5029842500927193
            > > >
            > > > Do you think this is a floating point issue? Anyone else heard of
            > > > this or know what to do?
            > > >
            > > > Thanks,
            > > > Rob
            > > >
            > > >
            > > >
            > > >
            > > >
            > > > [ Moderator Note: All static information is slowly moving to the
            > Wiki at
            > > > http://www.nslu2-linux.org ]
            > > >
            > > >
            > > > ________________________________
            > > > Yahoo! Groups Links
            > > > To visit your group on the web, go to:
            > > > http://groups.yahoo.com/group/nslu2-linux/
            > > >
            > > > To unsubscribe from this group, send an email to:
            > > > nslu2-linux-unsubscribe@yahoogroups.com
            > > >
            > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          • Rod Whitby
            On Sun, 30 Jan 2005 00:40:00 -0000, mrthreeplates ... Anything before 3.17 definitely has floating point problems (as it was a kernel patch that was required).
            Message 5 of 5 , Jan 29, 2005
            • 0 Attachment
              On Sun, 30 Jan 2005 00:40:00 -0000, mrthreeplates
              <mrthreeplates@...> wrote:
              > I am also getting floating point errors, but with PHP. I
              > am also getting strange behavior from imagemagick (hangs when
              > I try to create thumbnails or resize images).
              >
              > I'm hoping this problem will go away if I go to unslung 3.17, but
              > judging by this post, I'm not sure. Any advice?

              Anything before 3.17 definitely has floating point problems (as it was
              a kernel patch that was required).

              As for 3.17, python is the only thing which we have had reported with
              floating point problems so far, so we're not yet able to determine
              whether it is the cross compiler, or python, or a combination of both.
              Jacques is attempting to get python natively compiled so we can see
              if that will uncover where the problem is.

              -- Rod
            Your message has been successfully submitted and would be delivered to recipients shortly.