bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange division using mixed integers and floats


From: Kevin Rodgers
Subject: Re: Strange division using mixed integers and floats
Date: Tue, 27 Apr 2004 09:46:30 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]