From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Linas Vepstas Newsgroups: gmane.lisp.guile.user Subject: Re: strange behaviour of (floor .) Date: Sun, 3 Jan 2010 14:16:43 -0600 Message-ID: <3ae3aa421001031216q4c9939fdnedf14e832fa9734@mail.gmail.com> References: <20091228170236.GA27921@shoikan.fritz.box> <87skanf9ho.fsf@ambire.localdomain> <201001032051.o03KpS5O003665@fcs13.keithdiane.us> Reply-To: linasvepstas@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1262549827 30922 80.91.229.12 (3 Jan 2010 20:17:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jan 2010 20:17:07 +0000 (UTC) Cc: guile-user@gnu.org, ttn@gnuvola.org To: Keith Wright Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jan 03 21:16:59 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NRWsk-0002Ir-Jg for guile-user@m.gmane.org; Sun, 03 Jan 2010 21:16:58 +0100 Original-Received: from localhost ([127.0.0.1]:33612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRWsl-00073A-1W for guile-user@m.gmane.org; Sun, 03 Jan 2010 15:16:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRWsf-000722-Rf for guile-user@gnu.org; Sun, 03 Jan 2010 15:16:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRWsa-000700-Fc for guile-user@gnu.org; Sun, 03 Jan 2010 15:16:53 -0500 Original-Received: from [199.232.76.173] (port=41018 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRWsa-0006zr-D3 for guile-user@gnu.org; Sun, 03 Jan 2010 15:16:48 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:6438) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRWsa-0002rw-DH for guile-user@gnu.org; Sun, 03 Jan 2010 15:16:48 -0500 Original-Received: from mail-yx0-f177.google.com ([209.85.210.177]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRWsY-0008IL-On for guile-user@gnu.org; Sun, 03 Jan 2010 15:16:46 -0500 Original-Received: by yxe7 with SMTP id 7so13671771yxe.25 for ; Sun, 03 Jan 2010 12:16:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=GCUrPSFAKGKBbn8/c/hbYDcKKFMuCqG4h6hnK1hZKUg=; b=Lpun4eP9k0Dd27BLqRDjMsS3kxcKF4fYKPDVcqnuQXVYC/uzbJGmQcEeOMCHQbHx39 CqFbp7cVcAwI/6iFW399nZ3yYCE1eCiCooFgeKWD3g4zwA2JVn9mBc+I9n9iYdOAlw0L fC+Xhjutea2A3KEGI2FVNycVmzp68Xh3GnSMs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=QNxp5SEYjFklcHhpoxrWC5rXWkVA/lA/uyk4yhL6WpQjweCpsNof3Y8nLDLg7FeUtD RETcjJV5MRE5gM9zdywJBzJV6sgKLKqo3VVip2iiWPHU7DBz4rKvsETE+uq7/8iN9H8/ mqdjeQyze9p2cp9JRTr2lHrrIr+JCQEqYnSfo= Original-Received: by 10.101.187.18 with SMTP id o18mr24392440anp.8.1262549803941; Sun, 03 Jan 2010 12:16:43 -0800 (PST) In-Reply-To: <201001032051.o03KpS5O003665@fcs13.keithdiane.us> X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7596 Archived-At: 2010/1/3 Keith Wright : > > CFO: What happened to the $12,345.67? > You: Well, you see sir, IEEE floating point... Heh. Common misconception. The core problem, in accounting, is that some divisions and multiplications are allowed, and others are not. So for example, you are allowed to divide cost by number of shares to obtain share price (which is generally a flt pt number with 12 or more digits of precision). However, multiplying the number of shares by share price to obtain a dollar amount is forbiden, because doing so will always lead to roundoff errors in the cost, leading to all sorts of accounting imbalances, Example: bought 300 shares at $12.01/share on June 1st and bought 500 shares at $12.05/share on June 2nd. What was the average price paid? How many decimals are needed to correctly express this average share price? What number does one get when one computes the average share price times the total 800 shares bought? How does it compare to the actual cost paid? --linas