lua-users home
lua-l archive

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

<> <> 
 <> <>
In-Reply-To: <>
X-Organization: Home
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.08) POPstar/2.05
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

In message <> you wrote:

> Gavin Wraith wrote:
> > In message <> you wrote:
> Again, forgive my newbie impertinence, but mathematics aside, shouldn't 
> math.mod and '%' return the same result? Especially since '%' provides a 
> performance improvement? That way you can replace math.mod with '%' and 
> get a performance boost. And since '%' is new, shouldn't it do what 
> math.mod does, rather than vice versa?

One might also argue that by keeping them different the programmer can
choose which one he wants. Mathematicians want remainders that are
always positive, whatever the sign of the arguments. The fact that
programming language implementers have been getting it wrong for
nearly half a century is not a good argument for sticking with the
status quo. Haskell provides both alternatives, so Lua would be in
respectable company if it too decided to keep both.

Gavin Wraith (
Home page: