Subject: 23.2; Improper integer conversion (rounding?) on data entry in Calc

From: Keith Browne <[email-masked]>
Date: Tue, 30 Aug 2011 17:35:33 -0400 (EDT)

M-x calc [RETURN]
90000000000000010 [RETURN]
(that's 9, followed by fourteen 0s, followed by 10)

- Observe that 90000000000000016 appears on the stack, not 
90000000000000010.

This appears to be occurring for a bunch of different values, starting
somewhere below 20000000000000000 and running up through
900000000000000000 or higher.

It's occurring whether I type the values by hand, or cut and paste
through a window manager.  It's even happening if I enter the value
correctly in a different Emacs buffer and then cut and yank it into the
Calc buffer.

I've tested this on a variety of machines and versions of Emacs.  Some
work, some don't.  For instance, a powerpc-unknown-linux-gnu machine
running Emacs 23.3.1 is working, while an x86_64-apple-darwin10.8.0
machine running Emacs 23.3.1 is broken.

It could be a problem with the compiler toolchain that built the various
Emacsen.  Since identical versions of Emacs are either succeeding or
failing on different machines, it's unlikely to be a regression in Emacs
or in Calc.  Could it be that some machines are allowing the conversion
to pass through floating-point and back to int, resulting in a rounding
error?

In GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
  of 2011-04-04 on crested, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11001000
configured using `configure  '--build' 'x86_64-linux-gnu' '--build' 
'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var/lib' 
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' 
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 
'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 
'CPPFLAGS=''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_CA.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
   eldoc-mode: t
   paredit-mode: t
   show-paren-mode: t
   display-time-mode: t
   shell-dirtrack-mode: t
   nxhtml-global-minor-mode: t
   tooltip-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   size-indication-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
C-p C-n C-r e x p r - d a t a C-a C-n C-p C-f C-f C-f
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f
C-f C-f C-s m a t h - e x p r - d a t a C-a C-n C-p
C-s m a t h - e x p r - d a t a C-a C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p <help-echo>
C-x o C-n C-a C-n C-n C-n C-n C-n C-n C-n C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-x o C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-x o C-p C-p C-p C-p C-p C-p C-p C-p <help-echo> C-x
o C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-s m a t h - e x p r - d a t a C-s C-r C-a C-n C-n
C-n C-x o C-v C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-v C-v <escape> x r e p l <backspace>
o r t - e m a c s - b u g <return>

Recent messages:
Mark set [3 times]
Entering debugger...
(90000000000000016)
Undo! [6 times]
Mark set
Mark activated
Mark set
(90000000000000016)
Entering debugger...
Mark saved where search started [4 times]

Load-path shadows:
/home/tuxedo/SourceCode/lisp/emacsmodes/nxhtml/related/js2 hides 
/home/tuxedo/SourceCode/lisp/emacsmodes/js2
/home/tuxedo/SourceCode/lisp/emacsmodes/nxhtml/related/javascript hides 
/home/tuxedo/SourceCode/lisp/emacsmodes/javascript
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/slime 
hides /usr/share/emacs23/site-lisp/slime/slime
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/slime-autoloads 
hides /usr/share/emacs23/site-lisp/slime/slime-autoloads
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/hyperspec 
hides /usr/share/emacs23/site-lisp/slime/hyperspec
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-typeout-frame 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-typeout-frame
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-snapshot 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-snapshot
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-editing-commands 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-editing-commands
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-scheme 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-scheme
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-autodoc 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-autodoc
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/inferior-slime 
hides /usr/share/emacs23/site-lisp/slime/contrib/inferior-slime
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-hyperdoc 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-hyperdoc
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-repl 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-repl
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/bridge 
hides /usr/share/emacs23/site-lisp/slime/contrib/bridge
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-c-p-c 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-c-p-c
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-mrepl 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-mrepl
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-sbcl-exts 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-sbcl-exts
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-asdf 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-asdf
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-highlight-edits 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-highlight-edits
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-fuzzy 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-fuzzy
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-sprof 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-sprof
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-package-fu 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-package-fu
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-tramp 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-tramp
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-presentations 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-presentations
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-compiler-notes-tree 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-compiler-notes-tree
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-fontifying-fu 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-fontifying-fu
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-scratch 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-scratch
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-motd 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-motd
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-references 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-references
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-fancy-inspector 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-fancy-inspector
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-mdot-fu 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-mdot-fu
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-xref-browser 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-xref-browser
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-parse 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-parse
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-clipboard 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-clipboard
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-banner 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-banner
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-fancy 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-fancy
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-indentation 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-indentation
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-presentation-streams 
hides 
/usr/share/emacs23/site-lisp/slime/contrib/slime-presentation-streams
/home/tuxedo/quicklisp/dists/quicklisp/software/slime-20110730-cvs/contrib/slime-enclosing-context 
hides /usr/share/emacs23/site-lisp/slime/contrib/slime-enclosing-context
/usr/share/emacs/23.2/site-lisp/debian-startup hides 
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4
/usr/share/emacs23/site-lisp/flim/sha1 hides 
/usr/share/emacs/23.2/lisp/sha1
/usr/share/emacs23/site-lisp/flim/hex-util hides 
/usr/share/emacs/23.2/lisp/hex-util
/home/tuxedo/SourceCode/lisp/emacsmodes/nxhtml/util/htmlfontify hides 
/usr/share/emacs/23.2/lisp/htmlfontify
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides 
/usr/share/emacs/23.2/lisp/textmodes/flyspell
/home/tuxedo/SourceCode/lisp/emacsmodes/nxhtml/related/css-mode hides 
/usr/share/emacs/23.2/lisp/textmodes/css-mode
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides 
/usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/flim/sasl hides 
/usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs23/site-lisp/flim/sasl-digest hides 
/usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs23/site-lisp/flim/sasl-cram hides 
/usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs23/site-lisp/flim/ntlm hides 
/usr/share/emacs/23.2/lisp/net/ntlm
/usr/share/emacs23/site-lisp/flim/hmac-md5 hides 
/usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs23/site-lisp/flim/sasl-ntlm hides 
/usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs23/site-lisp/flim/hmac-def hides 
/usr/share/emacs/23.2/lisp/net/hmac-def
/home/tuxedo/SourceCode/lisp/emacsmodes/nxhtml/util/chart hides 
/usr/share/emacs/23.2/lisp/emacs-lisp/chart

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mailabbrev nnheader gmm-utils mailheader canlock
sha1 sha1-el hex-util hashcash mail-utils emacsbug help-mode view debug
calc-aent calc-yank etags calccomp calc-comb calc-ext calc-misc
calc-menu calc calc-loaddefs calc-macs vc-git imenu python-mode
ansi-color dired multi-isearch animate eldoc paredit saveplace paren
time cus-start cus-load color-theme sendmail reporter slime-tramp
tramp-imap assoc tramp-gw tramp-gvfs zeroconf dbus xml tramp-fish
tramp-smb tramp-cache tramp-ftp tramp-cmds tramp auth-source gnus-util
netrc shell password-cache format-spec tramp-compat trampver
slime-xref-browser tree-widget wid-edit slime-indentation slime-banner
slime-asdf slime-fancy slime-fontifying-fu slime-package-fu
slime-references slime-scratch slime-presentations slime-fuzzy
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
slime-parse slime-repl slime edmacro kmacro hideshow pp hyperspec
thingatpt browse-url nxhtml-autoload as-external server nxhtml-mumamo
mumamo-fun rx mumamo byte-opt bytecomp byte-compile sgml-mode flyspell
ispell nxhtml-menu xhtml-help flymake-js flymake-php flymake compile
comint ring hexcolor easy-mmode html-upl html-site derived url-http tls
url url-proxy url-privacy url-expand url-history mailcap url-auth
mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums time-date url-cookie
timezone url-util url-gw url-methods url-parse url-vars mm-util
mail-prsvr cl cl-19 majmodpri nxml-mode nxml-outln nxml-rap nxml-util
nxml-glyph nxml-enc xmltok ourcomments-util css-mode regexp-opt
nxhtml-autostart uniquify advice help-fns advice-preload info-look info
easymenu windmove w3m-load slime-autoloads tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)