John Beckett wrote:
> Ben Schmidt wrote:
>> math('sqrt',argument)
>> math('exp',exponent[,base=e])
>> math('log',argument[,base=e])
>> math('sin',argument[,degrees (bool)=0])
>> math('cos',argument[,degrees (bool)=0])
>> math('tan',argument[,degrees (bool)=0])
>> math('atan',argument[,degrees (bool)=0])
>
> Considering the functions, not the syntax to call them, I would have
> to suggest that it would be better to use Python-in-Vim for this sort
> of thing (and get complex numbers as well, plus heaps more).
You can leverage that argument about the entire floating point patch.
That said, the only functions I can imagine being truly useful in a text
editing setting, as opposed to an application that truly does require
something more numerically oriented, like a scripting language or
spreadsheet, are:
- rounding functions
- absolute value function
- sign function
- random number function
- power function (either exp() with variable base or pow() with
arguments in the reverse order)
Not the rest of the mathematical functions, the majority of which you
noted above. As I said, I can only think of 'toy' applications for them.
> It would be a pointless waste of development time to do much more with
> floats in Vim, IMHO.
Despite my comments above, I don't think writing a wrapper around a C
library function is long or hard work, which is basically all this
requires. If you're going to do one or two, which I think could be very
useful, you might as well do all ten while you're at it. Saves having to
do it later when someone discovers they need it!
But that said, yes, there are other Vim features I would much rather see
than this: variable tab stops, for instance, which are useful for many
more (most tab separated) data files than floating point computation is.
>> Are floats or doubles being used? They are definitely being
>> displayed with float, not double, precision at present.
>
> Vim's float code is using doubles.
>
> I haven't done anything serious with floats for years, but my vague
> recollection is that you would have to use something like
> printf('%.20f',myfloat) to see lots of precision (i.e. I think what
> you are seeing in Vim is just standard behaviour).
Yes, this works (well, 20 doesn't work, because they don't have that
much precision, so it just prints additional rubbish digits, but that is
as expected)!
Ben.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---