all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
@ 2020-04-27  7:12 Aitor Soroa
  2020-04-27  8:14 ` Andreas Schwab
  2020-04-30 12:53 ` Mattias Engdegård
  0 siblings, 2 replies; 9+ messages in thread
From: Aitor Soroa @ 2020-04-27  7:12 UTC (permalink / raw)
  To: 40892

The calculator.el: wrongly returns integers. For instance:

emacs -Q
M-x calculator
22 / 7

The answer is '3'. Even worse, If I set calculator-remove-zeros to nil, 
then I get '3.000'


In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2019-09-16 built on lcy01-amd64-030
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.4 LTS

Recent messages:
Configuring package ido...done
Loading package ido...done
Loading package projectile...
Configuring package projectile...done
Loading package projectile...done (0.190s)
Loading package ccls...
Configuring package cc-mode...done
Loading package ccls...done (0.388s)
For information about GNU Emacs and the GNU system, type C-h C-a.
Emacs ready in 2.22 seconds with 16 garbage collections.

Configured using:
'configure --build=x86_64-linux-gnu --prefix=/usr
'--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
'--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
--disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu'
'--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
--disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
--program-suffix=26 --with-modules --with-file-notification=inotify
--with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets
--with-lcms2 'CFLAGS=-g -O2
-fdebug-prefix-map=/build/emacs26-TP6iDo/emacs26-26.3~1.git96dd019=. 
-fstack-protector-strong
-Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time
-D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro
-no-pie''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD LCMS2

Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
global-company-mode: t
company-mode: t
projectile-mode: t
ido-vertical-mode: t
save-place-mode: t
override-global-mode: t
cl-old-struct-compat-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-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-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/dictionaries-common/flyspell hides 
/usr/share/emacs/26.3/lisp/textmodes/flyspell
/usr/share/emacs/site-lisp/dictionaries-common/ispell hides 
/usr/share/emacs/26.3/lisp/textmodes/ispell
/home/user/.emacs.d/elpa/flymake-1.0.8/flymake hides 
/usr/share/emacs/26.3/lisp/progmodes/flymake
/home/user/.emacs.d/elpa/org-20200406/org-loaddefs hides 
/usr/share/emacs/26.3/lisp/org/org-loaddefs
/home/user/.emacs.d/elpa/org-20200406/ob-sed hides 
/usr/share/emacs/26.3/lisp/org/ob-sed
/home/user/.emacs.d/elpa/org-20200406/ob-sqlite hides 
/usr/share/emacs/26.3/lisp/org/ob-sqlite
/home/user/.emacs.d/elpa/org-20200406/ob-asymptote hides 
/usr/share/emacs/26.3/lisp/org/ob-asymptote
/home/user/.emacs.d/elpa/org-20200406/org-id hides 
/usr/share/emacs/26.3/lisp/org/org-id
/home/user/.emacs.d/elpa/org-20200406/org-timer hides 
/usr/share/emacs/26.3/lisp/org/org-timer
/home/user/.emacs.d/elpa/org-20200406/ob-lisp hides 
/usr/share/emacs/26.3/lisp/org/ob-lisp
/home/user/.emacs.d/elpa/org-20200406/ob-abc hides 
/usr/share/emacs/26.3/lisp/org/ob-abc
/home/user/.emacs.d/elpa/org-20200406/ob-ebnf hides 
/usr/share/emacs/26.3/lisp/org/ob-ebnf
/home/user/.emacs.d/elpa/org-20200406/ob-ref hides 
/usr/share/emacs/26.3/lisp/org/ob-ref
/home/user/.emacs.d/elpa/org-20200406/org-faces hides 
/usr/share/emacs/26.3/lisp/org/org-faces
/home/user/.emacs.d/elpa/org-20200406/org-element hides 
/usr/share/emacs/26.3/lisp/org/org-element
/home/user/.emacs.d/elpa/org-20200406/org-capture hides 
/usr/share/emacs/26.3/lisp/org/org-capture
/home/user/.emacs.d/elpa/org-20200406/org-entities hides 
/usr/share/emacs/26.3/lisp/org/org-entities
/home/user/.emacs.d/elpa/org-20200406/ob-R hides 
/usr/share/emacs/26.3/lisp/org/ob-R
/home/user/.emacs.d/elpa/org-20200406/ob-mscgen hides 
/usr/share/emacs/26.3/lisp/org/ob-mscgen
/home/user/.emacs.d/elpa/org-20200406/org-footnote hides 
/usr/share/emacs/26.3/lisp/org/org-footnote
/home/user/.emacs.d/elpa/org-20200406/ob-lilypond hides 
/usr/share/emacs/26.3/lisp/org/ob-lilypond
/home/user/.emacs.d/elpa/org-20200406/ob-ocaml hides 
/usr/share/emacs/26.3/lisp/org/ob-ocaml
/home/user/.emacs.d/elpa/org-20200406/org-lint hides 
/usr/share/emacs/26.3/lisp/org/org-lint
/home/user/.emacs.d/elpa/org-20200406/ob-haskell hides 
/usr/share/emacs/26.3/lisp/org/ob-haskell
/home/user/.emacs.d/elpa/org-20200406/ob-stan hides 
/usr/share/emacs/26.3/lisp/org/ob-stan
/home/user/.emacs.d/elpa/org-20200406/ob-C hides 
/usr/share/emacs/26.3/lisp/org/ob-C
/home/user/.emacs.d/elpa/org-20200406/ob-table hides 
/usr/share/emacs/26.3/lisp/org/ob-table
/home/user/.emacs.d/elpa/org-20200406/ob-sass hides 
/usr/share/emacs/26.3/lisp/org/ob-sass
/home/user/.emacs.d/elpa/org-20200406/ob-org hides 
/usr/share/emacs/26.3/lisp/org/ob-org
/home/user/.emacs.d/elpa/org-20200406/org-plot hides 
/usr/share/emacs/26.3/lisp/org/org-plot
/home/user/.emacs.d/elpa/org-20200406/org-pcomplete hides 
/usr/share/emacs/26.3/lisp/org/org-pcomplete
/home/user/.emacs.d/elpa/org-20200406/ob-plantuml hides 
/usr/share/emacs/26.3/lisp/org/ob-plantuml
/home/user/.emacs.d/elpa/org-20200406/org-datetree hides 
/usr/share/emacs/26.3/lisp/org/org-datetree
/home/user/.emacs.d/elpa/org-20200406/ob-eval hides 
/usr/share/emacs/26.3/lisp/org/ob-eval
/home/user/.emacs.d/elpa/org-20200406/ox-ascii hides 
/usr/share/emacs/26.3/lisp/org/ox-ascii
/home/user/.emacs.d/elpa/org-20200406/org-src hides 
/usr/share/emacs/26.3/lisp/org/org-src
/home/user/.emacs.d/elpa/org-20200406/ob-maxima hides 
/usr/share/emacs/26.3/lisp/org/ob-maxima
/home/user/.emacs.d/elpa/org-20200406/org-agenda hides 
/usr/share/emacs/26.3/lisp/org/org-agenda
/home/user/.emacs.d/elpa/org-20200406/org-attach hides 
/usr/share/emacs/26.3/lisp/org/org-attach
/home/user/.emacs.d/elpa/org-20200406/ob-J hides 
/usr/share/emacs/26.3/lisp/org/ob-J
/home/user/.emacs.d/elpa/org-20200406/ob-forth hides 
/usr/share/emacs/26.3/lisp/org/ob-forth
/home/user/.emacs.d/elpa/org-20200406/org-inlinetask hides 
/usr/share/emacs/26.3/lisp/org/org-inlinetask
/home/user/.emacs.d/elpa/org-20200406/ox-beamer hides 
/usr/share/emacs/26.3/lisp/org/ox-beamer
/home/user/.emacs.d/elpa/org-20200406/ob-gnuplot hides 
/usr/share/emacs/26.3/lisp/org/ob-gnuplot
/home/user/.emacs.d/elpa/org-20200406/org-macro hides 
/usr/share/emacs/26.3/lisp/org/org-macro
/home/user/.emacs.d/elpa/org-20200406/ob-shell hides 
/usr/share/emacs/26.3/lisp/org/ob-shell
/home/user/.emacs.d/elpa/org-20200406/ob-emacs-lisp hides 
/usr/share/emacs/26.3/lisp/org/ob-emacs-lisp
/home/user/.emacs.d/elpa/org-20200406/ox-org hides 
/usr/share/emacs/26.3/lisp/org/ox-org
/home/user/.emacs.d/elpa/org-20200406/org-mobile hides 
/usr/share/emacs/26.3/lisp/org/org-mobile
/home/user/.emacs.d/elpa/org-20200406/ob-comint hides 
/usr/share/emacs/26.3/lisp/org/ob-comint
/home/user/.emacs.d/elpa/org-20200406/ob-screen hides 
/usr/share/emacs/26.3/lisp/org/ob-screen
/home/user/.emacs.d/elpa/org-20200406/ox-html hides 
/usr/share/emacs/26.3/lisp/org/ox-html
/home/user/.emacs.d/elpa/org-20200406/org-ctags hides 
/usr/share/emacs/26.3/lisp/org/org-ctags
/home/user/.emacs.d/elpa/org-20200406/ob-lob hides 
/usr/share/emacs/26.3/lisp/org/ob-lob
/home/user/.emacs.d/elpa/org-20200406/org-table hides 
/usr/share/emacs/26.3/lisp/org/org-table
/home/user/.emacs.d/elpa/org-20200406/ob-fortran hides 
/usr/share/emacs/26.3/lisp/org/ob-fortran
/home/user/.emacs.d/elpa/org-20200406/org-indent hides 
/usr/share/emacs/26.3/lisp/org/org-indent
/home/user/.emacs.d/elpa/org-20200406/org-list hides 
/usr/share/emacs/26.3/lisp/org/org-list
/home/user/.emacs.d/elpa/org-20200406/ob hides 
/usr/share/emacs/26.3/lisp/org/ob
/home/user/.emacs.d/elpa/org-20200406/ob-perl hides 
/usr/share/emacs/26.3/lisp/org/ob-perl
/home/user/.emacs.d/elpa/org-20200406/ox-odt hides 
/usr/share/emacs/26.3/lisp/org/ox-odt
/home/user/.emacs.d/elpa/org-20200406/org-colview hides 
/usr/share/emacs/26.3/lisp/org/org-colview
/home/user/.emacs.d/elpa/org-20200406/ox hides 
/usr/share/emacs/26.3/lisp/org/ox
/home/user/.emacs.d/elpa/org-20200406/ob-calc hides 
/usr/share/emacs/26.3/lisp/org/ob-calc
/home/user/.emacs.d/elpa/org-20200406/ox-icalendar hides 
/usr/share/emacs/26.3/lisp/org/ox-icalendar
/home/user/.emacs.d/elpa/org-20200406/org-version hides 
/usr/share/emacs/26.3/lisp/org/org-version
/home/user/.emacs.d/elpa/org-20200406/ox-md hides 
/usr/share/emacs/26.3/lisp/org/ox-md
/home/user/.emacs.d/elpa/org-20200406/ob-java hides 
/usr/share/emacs/26.3/lisp/org/ob-java
/home/user/.emacs.d/elpa/org-20200406/ob-latex hides 
/usr/share/emacs/26.3/lisp/org/ob-latex
/home/user/.emacs.d/elpa/org-20200406/ob-ruby hides 
/usr/share/emacs/26.3/lisp/org/ob-ruby
/home/user/.emacs.d/elpa/org-20200406/ob-ditaa hides 
/usr/share/emacs/26.3/lisp/org/ob-ditaa
/home/user/.emacs.d/elpa/org-20200406/ox-texinfo hides 
/usr/share/emacs/26.3/lisp/org/ox-texinfo
/home/user/.emacs.d/elpa/org-20200406/ob-sql hides 
/usr/share/emacs/26.3/lisp/org/ob-sql
/home/user/.emacs.d/elpa/org-20200406/ob-groovy hides 
/usr/share/emacs/26.3/lisp/org/ob-groovy
/home/user/.emacs.d/elpa/org-20200406/ox-latex hides 
/usr/share/emacs/26.3/lisp/org/ox-latex
/home/user/.emacs.d/elpa/org-20200406/ob-exp hides 
/usr/share/emacs/26.3/lisp/org/ob-exp
/home/user/.emacs.d/elpa/org-20200406/ob-clojure hides 
/usr/share/emacs/26.3/lisp/org/ob-clojure
/home/user/.emacs.d/elpa/org-20200406/org-compat hides 
/usr/share/emacs/26.3/lisp/org/org-compat
/home/user/.emacs.d/elpa/org-20200406/ob-css hides 
/usr/share/emacs/26.3/lisp/org/ob-css
/home/user/.emacs.d/elpa/org-20200406/org hides 
/usr/share/emacs/26.3/lisp/org/org
/home/user/.emacs.d/elpa/org-20200406/ob-python hides 
/usr/share/emacs/26.3/lisp/org/ob-python
/home/user/.emacs.d/elpa/org-20200406/ob-shen hides 
/usr/share/emacs/26.3/lisp/org/ob-shen
/home/user/.emacs.d/elpa/org-20200406/ob-dot hides 
/usr/share/emacs/26.3/lisp/org/ob-dot
/home/user/.emacs.d/elpa/org-20200406/ox-publish hides 
/usr/share/emacs/26.3/lisp/org/ox-publish
/home/user/.emacs.d/elpa/org-20200406/ob-vala hides 
/usr/share/emacs/26.3/lisp/org/ob-vala
/home/user/.emacs.d/elpa/org-20200406/ob-picolisp hides 
/usr/share/emacs/26.3/lisp/org/ob-picolisp
/home/user/.emacs.d/elpa/org-20200406/org-macs hides 
/usr/share/emacs/26.3/lisp/org/org-macs
/home/user/.emacs.d/elpa/org-20200406/ob-ledger hides 
/usr/share/emacs/26.3/lisp/org/ob-ledger
/home/user/.emacs.d/elpa/org-20200406/org-crypt hides 
/usr/share/emacs/26.3/lisp/org/org-crypt
/home/user/.emacs.d/elpa/org-20200406/org-mouse hides 
/usr/share/emacs/26.3/lisp/org/org-mouse
/home/user/.emacs.d/elpa/org-20200406/ob-octave hides 
/usr/share/emacs/26.3/lisp/org/ob-octave
/home/user/.emacs.d/elpa/org-20200406/org-archive hides 
/usr/share/emacs/26.3/lisp/org/org-archive
/home/user/.emacs.d/elpa/org-20200406/ox-man hides 
/usr/share/emacs/26.3/lisp/org/ox-man
/home/user/.emacs.d/elpa/org-20200406/ob-io hides 
/usr/share/emacs/26.3/lisp/org/ob-io
/home/user/.emacs.d/elpa/org-20200406/org-duration hides 
/usr/share/emacs/26.3/lisp/org/org-duration
/home/user/.emacs.d/elpa/org-20200406/ob-lua hides 
/usr/share/emacs/26.3/lisp/org/ob-lua
/home/user/.emacs.d/elpa/org-20200406/ob-tangle hides 
/usr/share/emacs/26.3/lisp/org/ob-tangle
/home/user/.emacs.d/elpa/org-20200406/ob-scheme hides 
/usr/share/emacs/26.3/lisp/org/ob-scheme
/home/user/.emacs.d/elpa/org-20200406/ob-hledger hides 
/usr/share/emacs/26.3/lisp/org/ob-hledger
/home/user/.emacs.d/elpa/org-20200406/org-habit hides 
/usr/share/emacs/26.3/lisp/org/org-habit
/home/user/.emacs.d/elpa/org-20200406/ob-awk hides 
/usr/share/emacs/26.3/lisp/org/ob-awk
/home/user/.emacs.d/elpa/org-20200406/ob-makefile hides 
/usr/share/emacs/26.3/lisp/org/ob-makefile
/home/user/.emacs.d/elpa/org-20200406/org-install hides 
/usr/share/emacs/26.3/lisp/org/org-install
/home/user/.emacs.d/elpa/org-20200406/org-feed hides 
/usr/share/emacs/26.3/lisp/org/org-feed
/home/user/.emacs.d/elpa/org-20200406/org-protocol hides 
/usr/share/emacs/26.3/lisp/org/org-protocol
/home/user/.emacs.d/elpa/org-20200406/org-clock hides 
/usr/share/emacs/26.3/lisp/org/org-clock
/home/user/.emacs.d/elpa/org-20200406/ob-matlab hides 
/usr/share/emacs/26.3/lisp/org/ob-matlab
/home/user/.emacs.d/elpa/org-20200406/ob-processing hides 
/usr/share/emacs/26.3/lisp/org/ob-processing
/home/user/.emacs.d/elpa/org-20200406/ob-core hides 
/usr/share/emacs/26.3/lisp/org/ob-core
/home/user/.emacs.d/elpa/org-20200406/ob-js hides 
/usr/share/emacs/26.3/lisp/org/ob-js
/home/user/.emacs.d/elpa/org-20200406/ob-coq hides 
/usr/share/emacs/26.3/lisp/org/ob-coq
/home/user/.emacs.d/elpa/let-alist-1.0.6/let-alist hides 
/usr/share/emacs/26.3/lisp/emacs-lisp/let-alist

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils ispell elec-pair ccls
ccls-member-hierarchy ccls-inheritance-hierarchy ccls-call-hierarchy
ccls-tree ccls-code-lens ccls-semantic-highlight ccls-common lsp
lsp-mode url-util tree-widget wid-edit subr-x spinner network-stream
puny nsm rmc starttls tls gnutls markdown-mode color noutline outline lv
json map inline imenu ht filenotify f s ewoc em-glob esh-util
dash-functional dash bindat cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs company-oddmuse
company-keywords company-etags etags xref project company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-bbdb company pcase projectile grep compile
comint ansi-color ring ibuf-ext ibuffer ibuffer-loaddefs thingatpt
flx-ido advice flx ido-vertical-mode ido cus-start cus-load dired-x
dired dired-loaddefs printing ps-print ps-print-loaddefs ps-def lpr epa
derived epg saveplace cl-extra help-mode use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core edmacro kmacro finder-inf tex-site rx info
package easymenu epg-config url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
xwidget-internal move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 435626 19099)
(symbols 48 39451 2)
(miscs 40 48 177)
(strings 32 138354 4060)
(string-bytes 1 3695638)
(vectors 16 46888)
(vector-slots 8 1613697 100408)
(floats 8 500 61)
(intervals 56 358 0)
(buffers 992 11))






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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-27  7:12 bug#40892: 26.3; emacs calculator.el: return values are truncated integers Aitor Soroa
@ 2020-04-27  8:14 ` Andreas Schwab
  2020-04-27  9:12   ` Tomas Nordin
  2020-04-30 12:53 ` Mattias Engdegård
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2020-04-27  8:14 UTC (permalink / raw)
  To: Aitor Soroa; +Cc: 40892

On Apr 27 2020, Aitor Soroa wrote:

> The calculator.el: wrongly returns integers. For instance:
>
> emacs -Q
> M-x calculator
> 22 / 7
>
> The answer is '3'. Even worse, If I set calculator-remove-zeros to nil,
> then I get '3.000'

This is consistent with how Emacs Lisp works:

ELISP> (/ 22 7)
3 (#o3, #x3, ?\C-c)
ELISP> (/ 22 7.0)
3.142857142857143

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-27  8:14 ` Andreas Schwab
@ 2020-04-27  9:12   ` Tomas Nordin
  2020-04-29 15:57     ` Noam Postavsky
  0 siblings, 1 reply; 9+ messages in thread
From: Tomas Nordin @ 2020-04-27  9:12 UTC (permalink / raw)
  To: Andreas Schwab, Aitor Soroa; +Cc: 40892

Andreas Schwab <schwab@linux-m68k.org> writes:

> On Apr 27 2020, Aitor Soroa wrote:
>
>> The calculator.el: wrongly returns integers. For instance:
>>
>> emacs -Q
>> M-x calculator
>> 22 / 7
>>
>> The answer is '3'. Even worse, If I set calculator-remove-zeros to nil,
>> then I get '3.000'
>
> This is consistent with how Emacs Lisp works:
>
> ELISP> (/ 22 7)
> 3 (#o3, #x3, ?\C-c)
> ELISP> (/ 22 7.0)
> 3.142857142857143

It might be a bit surprising through an interface that is meant to be
similar to popular calc apps (if meant so). On the other hand maybe one
wants to do integer divisions as well. This report could be a suggestion
of a new variable like 'treat-input-integers-as-floats'.





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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-27  9:12   ` Tomas Nordin
@ 2020-04-29 15:57     ` Noam Postavsky
  0 siblings, 0 replies; 9+ messages in thread
From: Noam Postavsky @ 2020-04-29 15:57 UTC (permalink / raw)
  To: Tomas Nordin; +Cc: 40892, Aitor Soroa, Andreas Schwab

>>> M-x calculator
>>> 22 / 7
>>>
>>> The answer is '3'.

>> ELISP> (/ 22 7)
>> 3 (#o3, #x3, ?\C-c)
>> ELISP> (/ 22 7.0)
>> 3.142857142857143
>
> It might be a bit surprising through an interface that is meant to be
> similar to popular calc apps (if meant so). On the other hand maybe one
> wants to do integer divisions as well. This report could be a suggestion
> of a new variable like 'treat-input-integers-as-floats'.

There is already an integer division operation:

    22.0 / 7 RET ===> 3.143

    22.0 \ 7 RET ===> 3

But we probably do still want an option, just because existing users may
want to keep the current behaviour.






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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-27  7:12 bug#40892: 26.3; emacs calculator.el: return values are truncated integers Aitor Soroa
  2020-04-27  8:14 ` Andreas Schwab
@ 2020-04-30 12:53 ` Mattias Engdegård
  2020-04-30 12:59   ` Noam Postavsky
  1 sibling, 1 reply; 9+ messages in thread
From: Mattias Engdegård @ 2020-04-30 12:53 UTC (permalink / raw)
  To: Noam Postavsky
  Cc: Andreas Schwab, 40892, Aitor Soroa, Tomas Nordin, Eli Barzilay

> But we probably do still want an option, just because existing users may want to keep the current behaviour. 

No we don't. It's a clear bug; let's just fix it.

In fact, it's a regression; in 22.1, at least, it works correctly. Looks like it was f248292ede.






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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-30 12:53 ` Mattias Engdegård
@ 2020-04-30 12:59   ` Noam Postavsky
  2020-04-30 13:15     ` Mattias Engdegård
  0 siblings, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2020-04-30 12:59 UTC (permalink / raw)
  To: Mattias Engdegård
  Cc: Andreas Schwab, 40892, Aitor Soroa, Eli Barzilay, Tomas Nordin

found 40892 26.1
tags 40892 + confirmed
quit

Mattias Engdegård <mattiase@acm.org> writes:

>> But we probably do still want an option, just because existing users may want to keep the current behaviour. 
>
> No we don't. It's a clear bug; let's just fix it.
>
> In fact, it's a regression; in 22.1, at least, it works correctly. Looks like it was f248292ede.

Ah, you're right.  It works as expected in 25.3 as well.






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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-30 12:59   ` Noam Postavsky
@ 2020-04-30 13:15     ` Mattias Engdegård
  2020-04-30 14:05       ` Eli Zaretskii
  2020-04-30 17:08       ` Eli Barzilay
  0 siblings, 2 replies; 9+ messages in thread
From: Mattias Engdegård @ 2020-04-30 13:15 UTC (permalink / raw)
  To: 40892-done
  Cc: Andreas Schwab, Eli Barzilay, Aitor Soroa, Tomas Nordin,
	Noam Postavsky

The simplest possible solution is to convert input numbers to float, which used to be how it worked. Done on emacs-27.

Thanks for the report!






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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-30 13:15     ` Mattias Engdegård
@ 2020-04-30 14:05       ` Eli Zaretskii
  2020-04-30 17:08       ` Eli Barzilay
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2020-04-30 14:05 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 40892, a.soroa

> From: Mattias Engdegård <mattiase@acm.org>
> Date: Thu, 30 Apr 2020 15:15:13 +0200
> Cc: Andreas Schwab <schwab@suse.de>, Eli Barzilay <eli@barzilay.org>,
>  Aitor Soroa <a.soroa@ehu.eus>, Tomas Nordin <tomasn@posteo.net>,
>  Noam Postavsky <npostavs@gmail.com>
> 
> The simplest possible solution is to convert input numbers to float, which used to be how it worked. Done on emacs-27.

I've reverted it, sorry.  Please don't put on emacs-27 anything that
doesn't have to be there.

This fix should go to master.





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

* bug#40892: 26.3; emacs calculator.el: return values are truncated integers
  2020-04-30 13:15     ` Mattias Engdegård
  2020-04-30 14:05       ` Eli Zaretskii
@ 2020-04-30 17:08       ` Eli Barzilay
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Barzilay @ 2020-04-30 17:08 UTC (permalink / raw)
  To: Mattias Engdegård
  Cc: Andreas Schwab, 40892-done, Aitor Soroa, Tomas Nordin,
	Noam Postavsky

Thanks for finally fixing it!  I've noticed this bug a long time ago,
and didn't get to fixing it, thinking that some would argue for a flag
instead of just going back to the original behavior...

On Thu, Apr 30, 2020 at 9:15 AM Mattias Engdegård <mattiase@acm.org> wrote:
>
> The simplest possible solution is to convert input numbers to float, which used to be how it worked. Done on emacs-27.
>
> Thanks for the report!
>


-- 
                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!





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

end of thread, other threads:[~2020-04-30 17:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27  7:12 bug#40892: 26.3; emacs calculator.el: return values are truncated integers Aitor Soroa
2020-04-27  8:14 ` Andreas Schwab
2020-04-27  9:12   ` Tomas Nordin
2020-04-29 15:57     ` Noam Postavsky
2020-04-30 12:53 ` Mattias Engdegård
2020-04-30 12:59   ` Noam Postavsky
2020-04-30 13:15     ` Mattias Engdegård
2020-04-30 14:05       ` Eli Zaretskii
2020-04-30 17:08       ` Eli Barzilay

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.