Bram Moolenaar wrote: > > Patrick Texier wrote: > >> On Fri, 20 Jun 2008 14:29:07 +0200, Vladimir Marek wrote: >> >> I don't have the previous post. >> >>>> As a workaround in eval.c you can simply replace >>>> rettv->vval.v_float = round(f); >>>> with >>>> rettv->vval.v_float = ceil(f + 0.5); >> Yes. > > I think it's: > if (f > 0) > return floor(f + 0.5) > else > return ceil(f - 0.5) > > Otherwise -1.5 doesn't work like round() does. Glad we have a test to > verify this :-)
Yes, that looks better. >>>> and >>>> rettv->vval.v_float = trunc(f); >>>> with >>>> rettv->vval.v_float = ceil(f); >> if (f < 0) >> rettv->vval.v_float = ceil(f); >> else >> rettv->vval.v_float = floor(f); > > Right. OK. Ben. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---