lua-users home
lua-l archive

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


	Hi Roberto

That certainly would help, but an essential point is to understand how
you *want* to round these values.
	This is a good question.
	Since 2.7 "has no integer representation", I could think that
'2' also hasn't.  But that is not what happens:

Lua 5.3.0  Copyright (C) 1994-2014 Lua.org, PUC-Rio
return string.format("%d", '2.7')
stdin:1: bad argument #2 to 'format' (number has no integer representation)
stack traceback:
	[C]: in function 'string.format'
	stdin:1: in main chunk
	[C]: in ?
return string.format("%d", '2')
2
return string.format("%d", '2.0')
2

	What is the rationale?	Are you considering a change on automatic
coercion?  It will probably produce a great compatibility problem but
it may be worth it...

	Regards,
		Tomás