On Fri, Mar 13, 2009 at 5:30 AM, Georg S. Weber <georgswe...@googlemail.com> wrote: > > > > On 12 Mrz., 16:51, Carl Witty <carl.wi...@gmail.com> wrote: >> On Thu, Mar 12, 2009 at 4:16 AM, David Joyner <wdjoy...@gmail.com> wrote: >> >> > I have an ignorant question: what are the canonical reps of >> > ZZZ/nZZZ in C? (-n/2,n/2]? >> > Is the issue to decide between the interval [0,n-1] as reps of ZZ/nZZ >> > (Python) >> > vs (-n/2,n/2] (C)? >> >> In C, ZZ/nZZ does not have canonical representatives. For example, >> the equivalent of [n%4 for n in [-7 .. 7]] would give: >> >> -3, -2, -1, 0, -3, -2, -1, 0, 1, 2, 3, 0, 1, 2, 3 > > Hi Carl, > > the situation might be worse: > AFAIK, that choice ist *not* defined by the ANSI C standard, but left > complier-dependent. In other words: you might get different answers on > the same system using different C compilers, or even the same C > compiler with different options. C is fun, isn't it?
Division/modulo was compiler-defined in the original ANSI C, but this was changed in C99, which specifies truncating division. Carl --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---