From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: Strange division using mixed integers and floats Date: Tue, 27 Apr 2004 09:46:30 -0600 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <408E8056.2070909@yahoo.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1083081825 18855 80.91.224.253 (27 Apr 2004 16:03:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 27 Apr 2004 16:03:45 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 27 18:03:39 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BIUwi-0000nb-00 for ; Tue, 27 Apr 2004 17:56:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BIUrb-0006Ho-UQ for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Apr 2004 11:51:15 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BIUqd-0005yn-OH for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2004 11:50:15 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BIUq6-0005qz-LG for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2004 11:50:14 -0400 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BIUmh-0004pE-Bj for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2004 11:46:11 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BIUmf-0000wQ-00 for ; Tue, 27 Apr 2004 17:46:10 +0200 Original-Received: from 170.207.51.80 ([170.207.51.80]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Apr 2004 17:46:09 +0200 Original-Received: from ihs_4664 by 170.207.51.80 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Apr 2004 17:46:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: bug-gnu-emacs@gnu.org Original-Lines: 37 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 170.207.51.80 User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:7780 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:7780 Johan Bockga*rd wrote: > Ok, I know why this happens: > > (/ 5 4) => 1 > > But this behaviour is *highly* confusing: > > (/ 5 4 2.3) => 0.4347826086956522 > > Cf. (/ 5 4.0 2.3) => 0.5434782608695653 > > At least there should be a warning in the manual. *** elisp-manual-21-2.8/numbers.texi.orig Sat Sep 8 11:42:52 2001 --- elisp-manual-21-2.8/numbers.texi Tue Apr 27 09:45:26 2004 *************** *** 541,547 **** divides @var{dividend} by each divisor in turn. Each argument may be a number or a marker. ! If all the arguments are integers, then the result is an integer too. This means the result has to be rounded. On most machines, the result is rounded towards zero after each division, but some machines may round differently with negative arguments. This is because the Lisp function --- 541,548 ---- divides @var{dividend} by each divisor in turn. Each argument may be a number or a marker. ! If both of the arguments are integers, then the result---the ! intermediate result, if there are additional arguments---is an integer too. This means the result has to be rounded. On most machines, the result is rounded towards zero after each division, but some machines may round differently with negative arguments. This is because the Lisp function -- Kevin Rodgers