> On 08/07/2014 09:24, tgingold@free.fr wrote: > >> I agree that the resolution proposal inherently feels wrong to use > >> as > >> a solution. > >> > >> I'm not sure I understand what the problems with (1) are (apart > >> from > >> overflowing) in performing all the arithmetic in normal integer > >> mode > >> and implicitly converting to the modular type on assignment. > > Well, the arithmetic is not the same. Eg: (3 + 1) mod 3 > > > > For a signed type, the result is 1. > > For a modular type with a modulus of 4, the result is 0. > > > > Regards, > > Tristan. > > > That's why the proposal is carry out the 'mod' function implicitly on > the final assignment to the actual. Let's me clarify: type T is mod 4; variable A : T; A := 3; -- 3 A := A + 1; -- 0 A := A mod 3; -- 0 So using modular arithmetic for each operator, you get for type T: (3 + 1) mod 3 = 0 No, using only 'mod' on the final assignment: A := (3 + 1) mod 3; <=> A := 4 mod 3; <=> A := 1; Conclusion: doing reduction on the final value is not equivalent to modular arithmetic. Regards, Tristan. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Jul 10 23:45:25 2014
This archive was generated by hypermail 2.1.8 : Thu Jul 10 2014 - 23:46:31 PDT