delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
From: | "Dave Korn" <dave DOT korn AT artimi DOT com> |
To: | <cygwin AT cygwin DOT com> |
References: | <5abc24640709270814j5148c43ejbfe46f022fd6ad1b AT mail DOT gmail DOT com> |
Subject: | RE: strange behavior with perl v 5.8.8 |
Date: | Thu, 27 Sep 2007 16:46:58 +0100 |
Message-ID: | <008b01c8011d$a3045a70$2e08a8c0@CAM.ARTIMI.COM> |
MIME-Version: | 1.0 |
X-Mailer: | Microsoft Office Outlook 11 |
In-Reply-To: | <5abc24640709270814j5148c43ejbfe46f022fd6ad1b@mail.gmail.com> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
On 27 September 2007 16:14, Andrew Louie wrote: > Hello, > > I've run into a strange adding problem with perl: > > when incrementing by 0.1 ... an infinite, non-repeating fraction in binary floating-point, that can only be inexactly approximated ... > i get a strange behavior where at some > arbitrary number, it will append 0.9999999999 to the end of the > number. 'fraid so. Use rounding if you like. This is bog-standard floating point behaviour, part of the fundamental limitations of the representation. See, e.g. http://docs.mandragor.org/files/Programming_languages/C/clc_faq_en/C-faq/q14.1 .html http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems or in general google for "floating point accuracy". cheers, DaveK -- Can't think of a witty .sigline today.... -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |