>>>> - Furthermore, on investigation, it seems there is an interesting
>>>>    definition of 'significant figures' in the library docs, and %.15g is
>>>>    the correct value, not %.16g. It might be worth noting at the printf()
>>>>    docs, or the Float docs where precision is mentioned, or both, that
>>>>    maximum precision output can be obtained with %.15g.
>>> I don't see this, for me %.16g does produce a longer result.
>> Yes, but the extra digits are bogus, as they are beyond the precision of
>> the underlying data type (double). Actually %.15e is reliably maximum
>> precision for a double. Depending on the size of the number and how %g
>> therefore decides to display it, it will either be %.15g or %.16g that
>> will be the maximum precision for that conversion. Quite awkward.
> 
> Doesn't this depend on the magnitude of the number?  Anyway, this is too
> much detail to mention in the Vim docs.

It depends on the magnitude of the number for %g but not for %e, which
is why I just suggest simply noting in a single line something like "to
display full precision, use %.15e." (That shows no more or less
precision than a double can represent, in all circumstances.) Unless you
think even that is too much detail.

> OK, just adding sin(), cos() and atan() sounds reasonable.  That avoids
> having to use an external program for that one user that does want to
> use trigonometric stuff.  Why atan() instead of tan()?

Thanks a lot, Bram! That is really great. (LOL. It was what I suggested
in the first place, too!)

To be able to do trigonometry you need at least one function going each
way--a 'forward' one like sin, cos, tan, and a 'backward' one like atan.
Sin, cos and atan are chosen because they are used more frequently than
the others, particularly for what is probably the most common case in
computing of coordinate conversion: (x,y)<->(r,theta):

x=r*cos(theta)
y=y*sin(theta)
r=sqrt(x*x+y*y)
theta=atan2(y,x) [or atan(y/x) with some surrounding logic]

Thanks again.

Ben.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui