help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculator: no exponent, full number ?


From: Marcin Borkowski
Subject: Re: Calculator: no exponent, full number ?
Date: Fri, 07 Jun 2019 21:36:11 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2019-06-06, at 18:50, Emanuel Berg via help-gnu-emacs 
<help-gnu-emacs@gnu.org> wrote:

> Marcin Borkowski wrote:
>
>>> (defun hypotenuse (c1 c2)
>>>   (sqrt (+ (* c1 c1) (* c2 c2))) )
>>
>> Just for the fun, let me mention that this is
>> not a very good algorithm for computing the
>> Pythagorean sum - it may happen that both the
>> operands and the result lie within the bounds
>> for the given type but this calculation blows
>> up because of large squares overflowing.
>
> Well, first let it be known that Marcin is
> a professional mathematician, famous for his

Professional - maybe, famous - luckily not.

> remarkable calculations. That said, the above
> comment is on the computer side of things,
> right? In the math world, what would happen is
> just a very large triangle, again - right?

Of course.  There is no overflow in maths;-).

>> Also, it is slow because of the need to
>> compute square roots. Interestingly, there
>> exists a clever algorithm that does not have
>> these problems.
>
> Why don't you post it in Elisp to prove my
> point one can use Elisp for math, even advanced
> math! <3

Not enough time...  Maybe in the future...

>> It is used (among others) in Donald Knuth's
>> METAFONT. The algorithm is described in the
>> paper (using Emanuel's favorite format;-)):
>
> That's true, I frekking *love* Biblatex! [2]
>
>> @ARTICLE{5390405,
>>   author={C. {Moler} and D. {Morrison}},
>>   journal={IBM Journal of Research and Development},
>>   title={Replacing Square Roots by Pythagorean Sums},
>>   year={1983},
>>   volume={27},
>>   number={6},
>>   pages={577-581},
>>   keywords={},
>>   doi={10.1147/rd.276.0577},
>>   ISSN={0018-8646},
>>   month={Nov},
>> }
>
> Only I keep mine much neater :)

"Mine" was autogenerated by some service on the web.

Best,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]