On Sun, 13 Jan 2013 05:32:55 -0500 "D. Michael McIntyre" <[email protected]> wrote:
> > a) fix it (it must be something really simple and stupid) > > Or complicated an interesting. > > According to three random calculators I tried, -2 mod 12 is 10, which is > clearly the assumption the person writing this code made. > > According to C++, -2 % 12 is -2. > > There's your problem. Interesting. That's a problem I *have* had to resolve. My way of doing so is simply to add the modulo value before the calculation to absolutely guarantee a consistent result. So (-2+12) % 12 will always give 10 whether it's python, C++, BASIC or an abacus! -- Will J Godfrey http://www.musically.me.uk Say you have a poem and I have a tune. Exchange them and we can both have a poem, a tune, and a song. ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 _______________________________________________ Rosegarden-user mailing list [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-user
