lua-users home
lua-l archive

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

The rationale is: because a and b are two close to be differentiated
when converting to a string, why would they be treated as different in
the number context?

The choice about string conversion has been made by the implementors of Lua as a pragmatic compromise. Whether or not they are close enough for a particular application may be different.

Or else: if they are considered different as numbers, why do we accept
that their string representation is equal?

See above.
I know this is not a real "solution", but it would be a step toward
avoiding a lot of rounding problems with floating point numbers

It doesn't avoid any rounding problems. It just arbitarily declares that some rounding should be enforced everywhere. Not a good idea - floating point isn't exact and encouraging people to think it is will cause more problems than it solves (IMO)