GNOME Bugzilla – Bug 319934
% Operator should do Modulus, not Percentage.
Last modified: 2005-10-27 16:57:54 UTC
The current behavior of the % button is to get the percentage of the two arguments. Whats even more odd is that 4%9 and 9%4 get the same value, 0.36? So it takes the lower number and divides it into the higher number? That makes no sense at all. The more common usage of the % symbol is for modulus. 9%4 should return 1 as it is the integer remainder of 9/4. -Google uses it as modulus: http://www.google.com/search?hl=en&q=9%254&btnG=Google+Search -Microsoft Windows calculator uses it as modulus -Python uses it as modulus -PHP and Perl use it as modulus etc I would suggest changing the behavior of the % button to modulus Other information:
See bug #135140 for details on why the percent operator is the way it currently is. Nothing odd about 4%9 and 9%4 both giving the same answer. 9 percent of 4 is the same as 4 percent of 9. As of the 5.7.X gcalctool series, there is also a Modulus operator. You can download a tarball from: http://ftp.gnome.org/pub/GNOME/sources/gcalctool/5.7/ What I have discovered is that the percent operator was broken when in non-arithmetic operator precedence mode. I've just checked a fix for that into CVS HEAD. That fix will show up in v5.7.9 (or later). I'll also attach the patch here for reference. In short, I'm closing this out as FIXED (because I did change something). If I hadn't found the fix, I would have closed it as NOTABUG.
Created attachment 53956 [details] Fix to get percent operator working in non-arithmetic operator precedence mode (again).