www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 551] New: Modulo operator works with imaginary and complex operands

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=551

           Summary: Modulo operator works with imaginary and complex
                    operands
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/expression.html
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com
OtherBugsDependingO 511
             nThis:


The spec states that "[t]he modulus operator only works with reals, it is
illegal to use it with imaginary or complex operands." yet DMD accepts all of
the following:

void main() {
        creal c = 1 + 1i;
        c %= 2;

        ireal i = 3i % 2;

        real r = 3 % 3i;
}


-- 
Nov 18 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-11-18:
 http://d.puremagic.com/issues/show_bug.cgi?id=551
 The spec states that "[t]he modulus operator only works with reals, it is
 illegal to use it with imaginary or complex operands." yet DMD accepts all of
 the following:

 void main() {
         creal c = 1 + 1i;
         c %= 2;

         ireal i = 3i % 2;

         real r = 3 % 3i;
 }
Added to DStress as http://dstress.kuehne.cn/nocompile/o/opMod_03_A.d http://dstress.kuehne.cn/nocompile/o/opMod_03_B.d http://dstress.kuehne.cn/nocompile/o/opMod_03_C.d http://dstress.kuehne.cn/nocompile/o/opMod_03_D.d http://dstress.kuehne.cn/nocompile/o/opMod_03_E.d http://dstress.kuehne.cn/nocompile/o/opMod_03_F.d http://dstress.kuehne.cn/nocompile/o/opMod_03_G.d http://dstress.kuehne.cn/nocompile/o/opMod_03_H.d http://dstress.kuehne.cn/nocompile/o/opMod_03_I.d http://dstress.kuehne.cn/nocompile/o/opMod_03_J.d http://dstress.kuehne.cn/nocompile/o/opMod_03_K.d http://dstress.kuehne.cn/nocompile/o/opMod_03_L.d http://dstress.kuehne.cn/nocompile/o/opMod_04_A.d http://dstress.kuehne.cn/nocompile/o/opMod_04_B.d http://dstress.kuehne.cn/nocompile/o/opMod_04_C.d http://dstress.kuehne.cn/nocompile/o/opMod_04_D.d http://dstress.kuehne.cn/nocompile/o/opMod_04_E.d http://dstress.kuehne.cn/nocompile/o/opMod_04_F.d http://dstress.kuehne.cn/nocompile/o/opMod_04_G.d http://dstress.kuehne.cn/nocompile/o/opMod_04_H.d http://dstress.kuehne.cn/nocompile/o/opMod_04_I.d http://dstress.kuehne.cn/nocompile/o/opMod_04_J.d http://dstress.kuehne.cn/nocompile/o/opMod_04_K.d http://dstress.kuehne.cn/nocompile/o/opMod_04_L.d http://dstress.kuehne.cn/nocompile/o/opMod_05_A.d http://dstress.kuehne.cn/nocompile/o/opMod_05_B.d http://dstress.kuehne.cn/nocompile/o/opMod_05_C.d http://dstress.kuehne.cn/nocompile/o/opMod_05_D.d http://dstress.kuehne.cn/nocompile/o/opMod_05_E.d http://dstress.kuehne.cn/nocompile/o/opMod_05_F.d http://dstress.kuehne.cn/nocompile/o/opMod_05_G.d http://dstress.kuehne.cn/nocompile/o/opMod_05_H.d http://dstress.kuehne.cn/nocompile/o/opMod_05_I.d http://dstress.kuehne.cn/nocompile/o/opMod_05_J.d http://dstress.kuehne.cn/nocompile/o/opMod_05_K.d http://dstress.kuehne.cn/nocompile/o/opMod_05_L.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFaFRVLK5blCcjpWoRAi6uAJ4gawAV8p8/Cov+FP7yE564dXwgaACfYre4 s7CWGWuax2UjvILplSwpRB4= =jR0k -----END PGP SIGNATURE-----
Nov 25 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=551






It's supported by the compiler, I'll change the docs.


-- 
Oct 03 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=551


braddr puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Docs updated in the 1.022/2.005 release to show that it's legal code.


-- 
Oct 20 2007