Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-ID: <000d01c0e507$64435540$0401a8c0@ntserv>
From: "Stan Malyshev" <stas@xpconsulting.com>
To: <cygwin@cygwin.com>
Subject: Fw: BUG REPORT:  unexpected floating point behavior
Date: Fri, 25 May 2001 03:42:27 -0700
Organization: XP Consulting, Inc.
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400


----- Original Message -----
From: Stan Malyshev
To: cygwin@cygwin.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

