lua-users home
lua-l archive

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


2014-04-05 0:29 GMT+02:00 Milind Gupta <milind.gupta@gmail.com>:

> Once these functions are removed don't we just have to include the
> following code in our Lua program if we use all these and we are good to go?
...
>
> Would these not be equivalent?

No.

As with any floating-point computation, there are numerical subtleties
involved that require expertise to overcome. William B Kahan, one of
the designers of the 8087 coprocessor, on which the IEEE 754 standard
is based, showed how to do it, and those are the formulas that, as
Roberto has correctly pointed out, could be implemented in Lua itself.

However, the quoted post demonstrates clearly that the typical
Lua user will not do that, but instead just apply the simple identities.
That is why the functions belong in a library.