http://d.puremagic.com/issues/show_bug.cgi?id=8672

           Summary: %% operator
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-09-16 13:31:40 PDT ---
This proposal is an alternative to the Issue 7728

I suggest to add the operator %% that performs a modulus operation closer to
the mathematics definition, as defined in Python.

%% acts as % when both its arguments are unsigned or when they are both
positive signed numbers.

I think here a built-in operator is better than a Phobos function (as discussed
in Issue 7728): the built-in "%" operator is bug-prone, if you use it with
negative numbers. In theory both a Phobos function and a built-in operator are
usable to avoid such bugs. But I think having a built-in operator allows
programmers to better remember the problem with the standard % derived from C
and more often avoid its usage when numbers are negative, compared to a library
function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to