With a small amount of testing, it's looking good, Bram. Tests says "ALL DONE" which I presume means they all passed.
A few points: - Wouldn't float2nr() be more consistent with the other Vim functions than float2number()? O yes! So much so that it seems that's what you implemented it as. It's wrongly documented, though. - The floor() function seems to be documented twice. - pow() isn't documented at all--works nicely, though! trunc() ditto. - The functions are not in correct alphabetical order in the docs. - The neater display is nice. IMHO it would be better to show full precision when this is there. I.e. it's great that :echo 2.7 shows just 2.7. But it'd be great if :echo 2.718281828459045 showed that, rather than just 2.718282. I guess this depends on printf, and so may not be possible (I can't get it to work in Vim at present, doing %.16g and %g loses it's nice truncation of zeros property), but it would be nicer, I think, if it is easily possible. - No chance of getting sin(), cos(), atan() and log10()? I realised after thinking a bit further and reading some other users' posts that these actually would truly be useful. Surely they would only take a few minutes to implement, no time to maintain, and I would have a lot of use for them. I don't know how many users are like me, but there must be a few as surely programming is fairly closely related to mathematics in many ways. (I'd like exp() and log() as well, but these can be done with pow() and log10() by appropriately defining e, so not an issue. tan(), sgn(), rand(), etc. are easy with scripts, too, so no problems there.) - Actually, though, an abs() function may be worth implementing, the reason being that with floats you often need to compare with a given precision to make it work. Since often computations will result in slightly different numbers, the == operator is not adequate, and you need to do something like abs(a-b) < 1.0e-9 as a kind of 'approximately equal to' instead. Note that I'm using runtime files from the ftp server (via aap). So if the patch does anything to them, it's not taking effect, because I'm replacing runtime files with aap; that may explain some of my documentation comments, I guess. Ben. Bram Moolenaar wrote: > - More functions, such as pow(), float2nr() and trunc(). > - round(), ceil() etc. return a Float instead of a Number. > - Added a test. Please try this, I don't know if roundoff errors might > break it. > - 1.0 / 0.0 should be handled correctly now. > - printf("%g", x) removes superfluous zeroes > > This patch goes on top of Vim 7.1.316. Remove the previous floating > point patch first, if you included it. The "extra" files are also > patched, you will get errors if you don't have them, they can be safely > ignored. > > Have fun. > > - > hundred-and-one symptoms of being an internet addict: > 42. Your virtual girlfriend finds a new net sweetheart with a larger > bandwidth. > > /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\ download, build and distribute -- http://www.A-A-P.org /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org /// > > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---