On Sat 21-Jun-08 11:41pm -0600, John Beckett wrote:
> My conclusion is that some variation of my earlier
> suggested code should be included
> in Vim so it does not rely on an external library for round/trunc.
This is much more reasonable than simply excluding some
users from the benefits of floating point.
Here are alternatives for your code:
For rounding you suggested:
f >= 0 ? floor(f + 0.5) : -floor(-f + 0.5)
Slightly simpler is:
f < 0 ? ceil(f - 0.5) : floor(f + 0.5)
For truncation you suggested:
f >= 0 ? floor(f) : -floor(-f)
Slightly simpler is:
f < 0 ? ceil(f) : floor(f)
--
Best regards,
Bill
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---