lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Aug 7, 2009 at 2:25 PM, Luiz Henrique de Figueiredo wrote:
> A simpler patch (with less #if) is this:
>
>>  static int Lnexttoward(lua_State *L)
>>  {
>> +#ifdef HAVE_NEXTTOWARD
>>    lua_pushnumber(L,nexttoward(A(1),A(2)));
>>    return 1;
>> +#else
>> +  return 0;
>> +#endif
>>  }
>
> Or even this:
>        #define nexttoward      nextafter
> ...
> I wonder whether there are other functions that cater only for long doubles.
>...
> Anyway, I think I'll just remove nexttoward from lmathx if no one minds.

I think it's best to remove it rather than have it behave incorrectly
(return 0).  Then one can test for existence ("if math.nexttoward
then") and act accordingly.  lmathx appears to not include long double
functions by design, though I guess you could "#define cosh coshl" if
you were compiling Lua with long doubles.

> I just wrote a binding based on all functions listed in
>   http://www.dinkumware.com/manuals/default.aspx?manual=compleat&page=math.htm

(note: above link extension should be ".html")

I probably already mentioned before that math.h contains a whole host
of interesting additional functions under C++.  This may warrant an
lmathxx library.  A lot of this is also in Boost [1-2].  Getting that
build automated under LuaRocks may take some work though--e.g.
LuaRocks currently has some issues with C++ [3].

[1] http://www.boost.org/doc/libs/1_35_0/libs/math/doc/sf_and_dist/html/index.html
[2] http://www.boost.org/doc/libs/1_35_0/libs/math/doc/html/index.html
[3] http://lists.luaforge.net/pipermail/luarocks-developers/2009-July/001113.html