| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Message-ID: | <8D00C32549556B4E977F81DBC24E985D1B1A2F@crtsmail1.technol_exch.corp.riotinto.org> |
| From: | "Billinghurst, David (CRTS)" <David DOT Billinghurst AT riotinto DOT com> |
| To: | "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com> |
| Subject: | RE: Fw: BUG REPORT: unexpected floating point behavior |
| Date: | Sat, 26 May 2001 05:12:27 -0000 |
| MIME-Version: | 1.0 |
| X-Mailer: | Internet Mail Service (5.5.2653.19) |
Try "What Every Computer Scientist Should Know about Floating-Point
Arithmetic" from http://gcc.gnu.org/readings.html or have a look at some of
the links on http://www.cs.berkeley.edu/~wkahan/
> -----Original Message-----
> From: Charles S. Wilson [SMTP:cwilson AT ece DOT gatech DOT edu]
> Sent: Saturday, May 26, 2001 12:59 AM
> To: Stan Malyshev
> Cc: cygwin AT cygwin DOT com
> Subject: Re: Fw: BUG REPORT: unexpected floating point behavior
>
> That's not a bug. It's just the way floating point works (or doesn't
> work). It boils down to a problem representing base10 floats with a
> 32bit base2 packed structure. You need to read up on floating point and
> precision. Try google...
>
> --Chuck
>
> Stan Malyshev wrote:
> >
> > ----- Original Message -----
> > From: Stan Malyshev
> > To: cygwin AT cygwin DOT com
> > Cc: Tennyson Lee
> > Sent: Friday, May 25, 2001 3:40 AM
> > Subject: BUG REPORT: unexpected floating point behavior
> >
> > Consider the following unexpected output of a simple loop that
> increments a
> > floating value by 0.1 at every iteration:
> >
> > #include <stdio.h>
> >
> > int main() {
> >
> > float x;
> >
> > for (x = 0; x < 4; x += 0.1f) {
> > printf("x=%f\n", x);
> > }
> >
> > return 0;
> > }
> >
> > ------------------
> >
> > x=0.000000
> > x=0.100000
> > x=0.200000
> > x=0.300000
> > x=0.400000
> > x=0.500000
> > x=0.600000
> > x=0.700000
> > x=0.800000
> > x=0.900000
> > x=1.000000
> > x=1.100000
> > x=1.200000
> > x=1.300000
> > x=1.400000
> > x=1.500000
> > x=1.600000
> > x=1.700000
> > x=1.800000
> > x=1.900000
> > x=2.000000
> > x=2.100000
> > x=2.200000
> > x=2.300000
> > x=2.400000
> > x=2.500000
> > x=2.600000
> > x=2.700000
> > x=2.799999
> > x=2.899999
> > x=2.999999
> > x=3.099999
> > x=3.199999
> > x=3.299999
> > x=3.399999
> > x=3.499999
> > x=3.599999
> > x=3.699999
> > x=3.799999
> > x=3.899998
> > x=3.999998
> >
> > --
> > Want to unsubscribe from this list?
> > Check out: http://cygwin.com/ml/#unsubscribe-simple
>
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |