lua-users home
lua-l archive

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

> So far the costs were discussed, what are the expected gains? Smaller
> size? How much? Any insights?

It is more a question of principles :)

In the old days (C89), it was easier to draw the line. Many functions in
the C math library seem useful and familiar (exp, sin, cos, tan, etc.);
even if there were a few not that common (like the hyperbolic ones), they
were only a few, and so the simplest thing to do was to add them all
to Lua's math lib.

Now, with C99, things are much more complex. First, there are many
more extra functions (not only in math.h but also those in fenv.h and
probably some others). Second, they are not available in all platforms
(our target is still C89, as much as possible). If we are to support
them all, sizes get larger and portability suffers. On the other hand,
if we do not add them all, where is the line? Should we keep the line
that C drawn many years ago and does not use any more? Is there any good
logic in having sinh but not asinh, isnormal, isinf, feraiseexcept,
expm1, log1p, hypot, cbrt, scalbn, and dozens more? All of them are
useful, but we must always keep in mind the bloating rule.

So, maybe a better line would be to keep the basic functions (roughly
what we learn in high school), and leave all those more advanced 
functions to an external library (such as mathx).

-- Roberto