[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#40892: 26.3; emacs calculator.el: return values are truncated intege
From: |
Tomas Nordin |
Subject: |
bug#40892: 26.3; emacs calculator.el: return values are truncated integers |
Date: |
Mon, 27 Apr 2020 11:12:12 +0200 |
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'.