emacs-devel
[Top][All Lists]
Advanced

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

Re: hypotenuse


From: Eli Zaretskii
Subject: Re: hypotenuse
Date: Sun, 21 Jul 2024 19:12:13 +0300

> From: Max Nikulin <manikulin@gmail.com>
> Date: Sun, 21 Jul 2024 22:54:53 +0700
> 
> On 21/07/2024 22:12, Christopher Dimech wrote:
> >>>> (defun hypotenuse (c1 c2)
> >>>>    (sqrt (+ (* c1 c1) (* c2 c2))) )
> > 
> > I have a solution to the problem in fortran, but not in elisp.  I could
> > include it.  Its implementation required serious concentration.
> 
> Underflow/overflow issues may be solved with a few lines of code and it 
> does matter if it is fortran, elisp, or another language (besides 
> pathological ones). The problem is to avoid error above 1 ULP.

Right, overflow and underflow are just the tip of a very large
iceberg.

> In 2021 hypot implementation in glibc was replaced by a more precise one:
> https://sourceware.org/git/?p=glibc.git;a=commit;h=6c848d70383e1dbe932ef41723ac0abfdeec7ca8

Which is exactly why I said we should use the existing implementation
in the standard library.



reply via email to

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