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 :-)

> > > 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.

> > On Solaris, all three (round, trunc, ceil) are part of libmath.so, so
> > you need #include <math.h> and link with -lm.
> 
> I can't find round and trunc in Borland header files.

In the FreeBSD manual pages ceil() and floor() are mentioned to be
according to C90 and C99, while round() and trunc() are only in C99.

How about strtod(), it's only in C99 as well.

-- 
Never go to the toilet in a paperless office.

 /// 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to