On Mon, Nov 26, 2018 at 2:10 AM Bram Moolenaar <[email protected]> wrote:
> Makes sense.  It is probably also more precise.  However, I think we
> only need to give one alternative for "pi", let's use the shortest one.

If the compiler (or the floating-point hardware) specialcases acos(-1)
— as IMHO every scientific compiler or coprocessor ought to do — then
acos(-1) is easier to write and remember, and just as precise as 4 *
atan(1). However, if the compiler compiles all inverse trigonometric
functions without specialcasing anything, then 4 * atan(1) is
inherently more precise because d/dx (atan x) = 1 for x = 1 while d/dx
(acos x) → ∞ when x → -1, which is why I had included both variants.

This said, I would use acos(-1) myself, at least with a "modern"
compiler and after checking that, on this compiler, acos(-1) == 4 *
atan(1) so I suppose that it is OK to omit the longer formula.

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui