unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Strange division using mixed integers and floats
@ 2004-04-26 15:02 Johan Bockgård
  2004-04-27 15:46 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Bockgård @ 2004-04-26 15:02 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (sparc-sun-solaris2.8, X toolkit)
 of 2002-09-24 on nob.dd.chalmers.se
configured using `configure  --x-includes=/opt/pd/include/ --x-libraries=/opt/pd/lib --prefix=/rec/emacs-21.2/'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: iso_8859_1
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

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.

Recent input:
C ESC O C ESC O C ESC O C ESC O C ESC O C ESC O D q 
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC 
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B 
ESC O B ESC O B ESC O B C-l ESC O A ESC O A ESC O A 
C-x b C-g ESC O A ESC O B ESC O B ESC x r e p o r t 
TAB RET

Recent messages:
Region saved
-1
0
0.0
Entering debugger...
 [2 times]
Back to top level.
Mark set
iswitchb-read-buffer: Quit
Loading emacsbug...done

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Strange division using mixed integers and floats
  2004-04-26 15:02 Strange division using mixed integers and floats Johan Bockgård
@ 2004-04-27 15:46 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2004-04-27 15:46 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-27 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-26 15:02 Strange division using mixed integers and floats Johan Bockgård
2004-04-27 15:46 ` Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).