From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Keith Wright Newsgroups: gmane.lisp.guile.user Subject: Re: strange behaviour of (floor .) Date: Sun, 3 Jan 2010 15:51:28 -0500 Message-ID: <201001032051.o03KpS5O003665@fcs13.keithdiane.us> References: <20091228170236.GA27921@shoikan.fritz.box> <87skanf9ho.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1262547868 25555 80.91.229.12 (3 Jan 2010 19:44:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jan 2010 19:44:28 +0000 (UTC) Cc: guile-user@gnu.org To: ttn@gnuvola.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jan 03 20:44:20 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 1NRWNA-0000xl-Bv for guile-user@m.gmane.org; Sun, 03 Jan 2010 20:44:20 +0100 Original-Received: from localhost ([127.0.0.1]:36276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRWNA-0000BX-GV for guile-user@m.gmane.org; Sun, 03 Jan 2010 14:44:20 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRWN7-0000BL-8R for guile-user@gnu.org; Sun, 03 Jan 2010 14:44:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRWN0-000060-Uk for guile-user@gnu.org; Sun, 03 Jan 2010 14:44:15 -0500 Original-Received: from [199.232.76.173] (port=45762 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRWN0-00005q-RJ for guile-user@gnu.org; Sun, 03 Jan 2010 14:44:10 -0500 Original-Received: from mail3.sea5.speakeasy.net ([69.17.117.5]:54037) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRWN0-00083G-Hz for guile-user@gnu.org; Sun, 03 Jan 2010 14:44:10 -0500 Original-Received: (qmail 25464 invoked from network); 3 Jan 2010 19:43:56 -0000 Original-Received: from dsl.keithdiane.us (HELO fcs12.keithdiane.us) ([66.92.74.188]) (envelope-sender ) by mail3.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 3 Jan 2010 19:43:56 -0000 Original-Received: from fcs13.keithdiane.us (fcs13 [192.168.1.112]) by fcs12.keithdiane.us (Postfix) with ESMTP id 1C54929EEBD; Sun, 3 Jan 2010 14:44:22 -0500 (EST) Original-Received: from fcs13.keithdiane.us (localhost.localdomain [127.0.0.1]) by fcs13.keithdiane.us (Postfix) with ESMTP id 82326AF4043; Sun, 3 Jan 2010 15:51:47 -0500 (EST) Original-Received: (from kwright@localhost) by fcs13.keithdiane.us (8.13.1/8.13.1/Submit) id o03KpS5O003665; Sun, 3 Jan 2010 15:51:28 -0500 X-Authentication-Warning: fcs13.keithdiane.us: kwright set sender to kwright@keithdiane.us using -f In-reply-to: <87skanf9ho.fsf@ambire.localdomain> (message from Thien-Thi Nguyen on Sun, 03 Jan 2010 17:17:55 +0100) 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:7595 Archived-At: > From: Thien-Thi Nguyen > > Note, however, that usually it is better (less fiddly) > to represent monetary values as integers. Yes, always represent money as an integer number of cents and put in a decimal point when you print. That is, "$16.98" is produced by something like (money->string 1698). This is true for ALL languages, although it is especially easy to do in Scheme with its large integer arithmetic. If you will need large integers in some other language, take the time to implement them. You do NOT want to lose precision by using floating point. "Fiddly" is the least of your worries; you might go to jail for round-off error. You do not want to finish this conversation: CFO: What happened to the $12,345.67? You: Well, you see sir, IEEE floating point... -- Keith