I val 在 < em> scratch em> 中的 Lisp 表达式
(+ (/ 1 2) (/ 1 2))
我有一个0。
通常应为1。
I val 在 < em> scratch em> 中的 Lisp 表达式
(+ (/ 1 2) (/ 1 2))
我有一个0。
通常应为1。
正如Oleg指出的,操作员通常默认为整数算术,除非包括浮动点参数(例如 1.0
)。
关于您关于合理数字支持的问题, mascs- calc (这是macs的一部分) 支持许多数字类型, 包括分数( 即合理数字)、 复杂数字、 无限精确的整数等。 您的代码必须调用 mecs- calc 函数( 而不是 < code > / code > 等), 才能使用 calc 算术 。
GNU Emacs Calc 手册 :
这样试试
(+ (/ 1.0 2) (/ 1.0 2))
函数 : / 红利 divisor & amp; rest divisors
如果所有参数都是整数,则结果也是整数。
您可以在这里读取关于数字的全部 :
C-h i g (lisp) 数字
RET
三胞胎已经指出,显然答案是“不”。
Emacs calc
具有合理数据类型:使用冒号,如 1:2 = = 0.5
或 5:3 = 1 + 2 = 2 = 2 = = = 1:2:3
。
Emacs calc
简化表达式, 例如, 如果您处理 192: 1080
的显示分辨率, 它会打印 16: 9
! 如果您想要1440p 16: 9比率 : 1440 * 16: 9
* 16: 9 < code> < 2560 。
I started using ruby-electric-mode. I like it except that I am used to closing open brackets myself (the other pairing are still useful to me). How can I make emacs suppress additional brackets when ...
I am currently constrained to a windows dev box and I want to migrate my projects from eclipse to emacs. What are some good references on setting up an emacs dev environment for windows? Anything ...
I would like to have which-function-mode on by default when I open up Emacs. I ve added the following lines to my .emacs file. (setq which-func-mode t) (setq which-function-mode t) When I open ...
I don t seem to be able to enable a go mode for emacs. C mode doesn t work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom, since JavaScript also doesn t require ...
The key bindings I ve defined in my .emacs file aren t working. Here s the file: ;init modes (menu-bar-mode 0) (tool-bar-mode 0) (cua-mode) (column-number-mode) (fset perl-mode cperl-mode) (cperl-...
How can I fix the simple macro foo in (elisp)Eval During Expansion? None of the followings work: (defmacro foo1 (a) `(setq (eval ,a) t)) (defmacro foo2 (a) `(setq ,(eval a) t)) (defmacro foo3 (...
When I open a multi-byte file, I get this:
I often commit files with similar cvs comment but not in a single operation. I would like to able to bring up previous comments I ve used in a previous commit when I am in the process of writing a ...