* bug#37235: 26.1; Precedence error in calc-eval
@ 2019-08-30 13:41 Charles Karney via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-08-30 15:04 ` Mauro Aranda
2019-08-30 15:07 ` Andreas Schwab
0 siblings, 2 replies; 5+ messages in thread
From: Charles Karney via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2019-08-30 13:41 UTC (permalink / raw)
To: 37235
In GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.23.2)
of 2018-08-13 built on buildvm-13.phx2.fedoraproject.org
Windowing system distributor 'Fedora Project', version 11.0.12004000
System Description: Fedora release 29 (Twenty Nine)
The precedence of calc-eval doesn't follow C-like rules.
(calc-eval "1/2*3") returns "0.166666666667"
returning the same answer as (calc-eval "1/2/3"). It should return
"1.5".
Configured using:
'configure --build=x86_64-redhat-linux-gnu
--host=x86_64-redhat-linux-gnu --program-prefix=
--disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
--libexecdir=/usr/libexec --localstatedir=/var
--sharedstatedir=/var/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
--with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
--with-gpm=no --with-xwidgets --with-modules
build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu
'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
LDFLAGS=-Wl,-z,relro
PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY ACL
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS XWIDGETS LCMS2
Important settings:
value of $LC_COLLATE: C
value of $LC_TIME: C
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=none
locale-coding-system: utf-8-unix
Major mode: Fundamental
Minor modes in effect:
diff-auto-refine-mode: t
save-place-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-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/site-start.d/maxima-modes hides
/usr/share/emacs/site-lisp/maxima/site_start.d/maxima-modes
Features:
(shadow sort emacsbug help-mode cl-print debug calc-alg ispell maxima
maxima-font-lock rect misearch multi-isearch calc-map calc-stat calc-vec
calc-ext calc-menu calc-aent calc calc-loaddefs calc-macs org-table
org-rmail org-mhe org-irc org-info org-gnus nnir gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gnus
nnheader wid-edit org-docview doc-view jka-compr image-mode org-bibtex
bibtex org-bbdb org-w3m org-element avl-tree generator org advice
org-macro org-footnote org-pcomplete pcomplete org-list org-faces
org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle
org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
find-func cal-menu calendar cal-loaddefs vc-git diff-mode easy-mmode
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs mail-extr message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader warnings lpr elec-pair saveplace
edmacro kmacro tempo url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse url-vars mailcap
xml-parse doxymacs matlab-load cmake-mode thingatpt rx smtpmail
auth-source cl-seq eieio eieio-core eieio-loaddefs password-cache
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
50magit clang-rename clang-include-fixer let-alist json map seq byte-opt
bytecomp byte-compile cconv clang-format cl-macs gv xml 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 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 295915 64123)
(symbols 48 39027 3)
(miscs 40 315 855)
(strings 32 88008 6139)
(string-bytes 1 2737911)
(vectors 16 42045)
(vector-slots 8 1462820 203824)
(floats 8 223 624)
(intervals 56 3321 604)
(buffers 992 34))
--
Charles Karney <charles@karney.com>
Princeton, NJ 08540, USA
https://www.petrel.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#37235: 26.1; Precedence error in calc-eval
2019-08-30 13:41 bug#37235: 26.1; Precedence error in calc-eval Charles Karney via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2019-08-30 15:04 ` Mauro Aranda
2019-08-30 15:26 ` Noam Postavsky
2019-09-16 3:06 ` Stefan Kangas
2019-08-30 15:07 ` Andreas Schwab
1 sibling, 2 replies; 5+ messages in thread
From: Mauro Aranda @ 2019-08-30 15:04 UTC (permalink / raw)
To: Charles Karney; +Cc: 37235
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
tags 37235 notabug
quit
Charles Karney via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:
> In GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.23.2)
> of 2018-08-13 built on buildvm-13.phx2.fedoraproject.org
> Windowing system distributor 'Fedora Project', version 11.0.12004000
> System Description: Fedora release 29 (Twenty Nine)
>
> The precedence of calc-eval doesn't follow C-like rules.
>
> (calc-eval "1/2*3") returns "0.166666666667"
>
> returning the same answer as (calc-eval "1/2/3"). It should return
> "1.5".
>
It works as documented in the Calc manual, section 5.15 Formulas:
C-h i m calc RET 5 m formulas RET
Calc gives '/' lower precedence than '*' by default.
To make Calc follow C-like rules, you can set it with the command
calc-c-language. You can read its documentation with:
C-h i m calc RET i calc-c-language
Best regards,
Mauro.
[-- Attachment #2: Type: text/html, Size: 1275 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#37235: 26.1; Precedence error in calc-eval
2019-08-30 15:04 ` Mauro Aranda
@ 2019-08-30 15:26 ` Noam Postavsky
2019-09-16 3:06 ` Stefan Kangas
1 sibling, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2019-08-30 15:26 UTC (permalink / raw)
To: Mauro Aranda; +Cc: Charles Karney, 37235
Mauro Aranda <maurooaranda@gmail.com> writes:
>>
>> The precedence of calc-eval doesn't follow C-like rules.
>>
>> (calc-eval "1/2*3") returns "0.166666666667"
>>
>> returning the same answer as (calc-eval "1/2/3"). It should return
>> "1.5".
>>
>
> It works as documented in the Calc manual, section 5.15 Formulas:
> C-h i m calc RET 5 m formulas RET
>
> Calc gives '/' lower precedence than '*' by default.
Also see (info "(calc) Basic Arithmetic"),
> To make Calc follow C-like rules, you can set it with the command
> calc-c-language. You can read its documentation with:
> C-h i m calc RET i calc-c-language
which mentions calc-multiplication-has-precedence.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#37235: 26.1; Precedence error in calc-eval
2019-08-30 15:04 ` Mauro Aranda
2019-08-30 15:26 ` Noam Postavsky
@ 2019-09-16 3:06 ` Stefan Kangas
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2019-09-16 3:06 UTC (permalink / raw)
To: Mauro Aranda; +Cc: Charles Karney, 37235-done
Mauro Aranda <maurooaranda@gmail.com> writes:
>
> tags 37235 notabug
> quit
>
> Charles Karney via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
> > In GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.23.2)
> > of 2018-08-13 built on buildvm-13.phx2.fedoraproject.org
> > Windowing system distributor 'Fedora Project', version 11.0.12004000
> > System Description: Fedora release 29 (Twenty Nine)
> >
> > The precedence of calc-eval doesn't follow C-like rules.
> >
> > (calc-eval "1/2*3") returns "0.166666666667"
> >
> > returning the same answer as (calc-eval "1/2/3"). It should return
> > "1.5".
> >
>
> It works as documented in the Calc manual, section 5.15 Formulas:
> C-h i m calc RET 5 m formulas RET
>
> Calc gives '/' lower precedence than '*' by default.
>
> To make Calc follow C-like rules, you can set it with the command
> calc-c-language. You can read its documentation with:
> C-h i m calc RET i calc-c-language
Since this is notabug, I'm also closing it.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#37235: 26.1; Precedence error in calc-eval
2019-08-30 13:41 bug#37235: 26.1; Precedence error in calc-eval Charles Karney via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-08-30 15:04 ` Mauro Aranda
@ 2019-08-30 15:07 ` Andreas Schwab
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2019-08-30 15:07 UTC (permalink / raw)
To: 37235; +Cc: charles.karney
On Aug 30 2019, Charles Karney via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> wrote:
> The precedence of calc-eval doesn't follow C-like rules.
>
> (calc-eval "1/2*3") returns "0.166666666667"
>
> returning the same answer as (calc-eval "1/2/3"). It should return
> "1.5".
It is documented that multiplication has higher precedence than
devision (see (calc) Formulas). Calc is following the rules of
Algebra.
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] 5+ messages in thread
end of thread, other threads:[~2019-09-16 3:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-30 13:41 bug#37235: 26.1; Precedence error in calc-eval Charles Karney via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-08-30 15:04 ` Mauro Aranda
2019-08-30 15:26 ` Noam Postavsky
2019-09-16 3:06 ` Stefan Kangas
2019-08-30 15:07 ` Andreas Schwab
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.