lua-users home
lua-l archive

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



Fix to this problem was figured out and placed to my personal svn (where LNUM can be downloaded).

	svn co svn://slugak.dyndns.org/public/2010/LNUM2

However, I do not intend to make new "distribution" of this, nor carry on the LNUM patch to Lua 5.2.

-asko


Flemming Madsen kirjoitti 17.5.2010 kello 8:55:

This is about Lua *with* the lnum patch (And I know, there's still no
difference)

This is all beside the point. The whole thing was brought to my
attention by the fact that string.format("%d", 1.00001) was ok while
string.format("%d", 0.999999) would give an error.

This what the sample Lua session in my first post tried to show.

Cheers /Flemming


On Sun, May 16, 2010 at 11:43 AM, David Kastrup <dak@gnu.org> wrote:
Flemming Madsen <lua@themadsens.dk> writes:

On Wed, May 12, 2010 at 4:58 AM, Richard Hundt <richardhundt@gmail.com > wrote:

Integers are defined as a subset of real numbers that are *whole* (i.e which can be written without a fractional or decimal component). Numbers between -1.0 < x < 1.0 therefore *cannot* be integers, so unless I've misunderstood,
the existing behaviour was exactly what you wanted there.

http://en.wikipedia.org/wiki/Integer

I already knew that, thanks.

The practical implication however is that -1.0 < x < 1.0 can not be
*cast* to integers. At least not by the %d operator of string.format()

There is no difference between 0 and 0.0 for Lua.

--
David Kastrup