Oops, d/dx(atan x) is slightly less than 1 for x=1 but it is still much better-behaved than "infinity".
Best regards, Tony. On Mon, Nov 26, 2018 at 3:30 AM Tony Mechelynck <antoine.mechely...@gmail.com> wrote: > > On Mon, Nov 26, 2018 at 2:10 AM Bram Moolenaar <b...@moolenaar.net> 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.