X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <5abc24640709270814j5148c43ejbfe46f022fd6ad1b@mail.gmail.com> Date: Thu, 27 Sep 2007 11:14:09 -0400 From: "Andrew Louie" To: cygwin AT cygwin DOT com Subject: strange behavior with perl v 5.8.8 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hello, I've run into a strange adding problem with perl: when incrementing by 0.1 i get a strange behavior where at some arbitrary number, it will append 0.9999999999 to the end of the number. test case: ------------------------------------------------------------------------------------ my $start = 0; my $interval = 0.1; my $end = 10; do{ print "start: $start\n"; $start += $interval;}until($start >= $end); ------------------------------------------------------------------------------------ Results: ... start: 4.5 start: 4.6 start: 4.7 start: 4.8 start: 4.9 start: 5 start: 5.1 start: 5.2 start: 5.3 start: 5.4 start: 5.5 start: 5.6 start: 5.7 start: 5.8 start: 5.9 start: 5.99999999999999 start: 6.09999999999999 start: 6.19999999999999 start: 6.29999999999999 start: 6.39999999999999 start: 6.49999999999999 start: 6.59999999999999 start: 6.69999999999999 start: 6.79999999999999 start: 6.89999999999999 ------------------------------------------------------------------------------------ why all of suddun i get 5.999999999? Is this a perl problem? im using cygwin version 1.5.24 perl -v: This is perl, v5.8.8 built for cygwin-thread-multi-64int (with 8 registered patches, see perl -V for more detail) -- -Andrew Louie -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/