lua-users home
lua-l archive

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


<7d54136d4d.wra1th@wra1th.plus.com> <428C6822.1070407@gimp.org> 
 <891d756d4d.wra1th@wra1th.plus.com> <428CA527.6060500@marrin.com>
In-Reply-To: <428CA527.6060500@marrin.com>
X-Organization: Home
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.08) POPstar/2.05
Reply-To: gavin@wra1th.plus.com
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

In message <428CA527.6060500@marrin.com> you wrote:

> Gavin Wraith wrote:
> 
> > In message <428C6822.1070407@gimp.org> 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 (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/