[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 --- Additional comments from [EMAIL PROTECTED] Tue Jan 9 21:35:51 -0800 2007 --- er: "actually LCM(0.4;1.2) "sort of" works, it just doesn't give the result one would expect" Enjoyed that, thank you :) "As a conclusion we should allow negative arguments, truncate fractional values to integer" OK "(we might come up with a proper fractional algorithm later as an addition if someone feels challenged :)" Doesn't seem likely does it ;) "and return always positive numbers." This is a change in behaviour. That's fine by me because the definition is sensible, but might it cause trouble for previous users? It's useful that the current behaviour is undocumented. I guess this is your decision to make. It would also be useful to have GCD(0;0) return zero by definition. Many thanks. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 --- Additional comments from [EMAIL PROTECTED] Tue Jan 9 07:39:52 -0800 2007 --- Well, actually LCM(0.4;1.2) "sort of" works, it just doesn't give the result one would expect, which is because it uses the broken GCD method to determine the value. LCM(0.4;1.2) * GCD(0.4;1.2) gives 0.48 that is correct. As for negative results if one of the arguments is negative, a GCD always returns one of the possible factors. Even GCD(12;3) has two solutions, 4 and -4. Since the "greatest" semantically somehow implies to choose the positive value, and especially as some sources say to not regard factorization into negative numbers and some sources say the result is a positive integer (natural number), I tend to use that. For the |a*b|=... relationship, most sources omit the absolute value there, including the http://en.wikipedia.org/wiki/Greatest_common_divisor page. However, I think that's wrong. Several sources talk of integer values, not mentioning positive integers nor natural numbers. The German http://de.wikipedia.org/wiki/Gr%C3%B6%C3%9Fter_gemeinsamer_Teiler page states the relationship, but what finally convinced me was that the "Bronstein/Semendjajew" standard book of mathematics does so as well, and also mentions only integer numbers for arguments, nothing about positive values. As a conclusion we should allow negative arguments, truncate fractional values to integer (we might come up with a proper fractional algorithm later as an addition if someone feels challenged :) and return always positive numbers. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 --- Additional comments from [EMAIL PROTECTED] Mon Jan 8 15:24:15 -0800 2007 --- Thank you. LCM doesn't currently work with non-integers eg LCM(0.4;1.2) so you'd probably need to tackle that as well if you wanted to have GCD working with non-integers. The other issue about negative arguments is when they are mixed, eg -12 and +15. GCD and LCM return negative results - I guess as a matter of definition rather than mathematics? That still obeys |a*b| = GCD(a,b) * LCM(a,b) but the | | is then crucial. The formula does appear sometimes as a*b = GCD(a,b) * LCM(a,b) in which case it fails - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 User er changed the following: What|Old value |New value Status|NEW |STARTED OS/Version|Windows XP|All Platform|PC|All Target milestone|--- |OOo 2.x --- Additional comments from [EMAIL PROTECTED] Mon Jan 8 11:50:16 -0800 2007 --- Of course a result of zero is never correct except maybe if both arguments are zero. Note however that the visible zeros of the testcases in fact are only rounded for the display value, despite the fact that GCD for non-integers isn't defined. Strictly spoken GCD(0;0) is undefined because of the infinite number of common divisors, however, it can be convenient to define GCD(0;0)=0 as Excel does. As for the handling of negative arguments I'm undecided. Mathematically the relation |a*b| = GCD(a,b) * LCM(a,b) is given, so a negative result would play well. Some sources define GCD to be the largest positive integer, but neither that nor the non-negative argument seem to be a mathematical restriction. That relationship btw possibly is the reason why the functions were implemented the way they are, working on non-integers and delivering the "strange" results; in the testcases, calculating the LCM of the same numbers and multiplying with the GCD produces the same amount as multiplying the numbers. However, the algorithm for finding the GCD for fractional numbers is not appropriate, as can easily be seen with GCD(1.2;3.6) GCD_ADD of course should strictly mimic the Excel behavior. Even though a GCD of rational numbers isn't defined, a LCM of rational numbers actually may make sense to compute the recurrence of a wave form. To comply with the relationship given above a GCD should also be able to handle it. So either enhance the GCD algorithm or change both to truncate fractional arguments to integers. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 User er changed the following: What|Old value |New value Assigned to|spreadsheet |er --- Additional comments from [EMAIL PROTECTED] Mon Jan 8 07:24:12 -0800 2007 --- Grabbing issue. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 --- Additional comments from [EMAIL PROTECTED] Wed Jan 3 00:44:38 -0800 2007 --- I think you are absolutely right about the difficulties with non-integers. The Mathematica manual uses fractions for its examples: GCD(1/2, 3/4) is 1/4 - and this is pretty sensible. But with floats we get very messy. For instance the open-formula draft says that Calc GCD(18.1;24.1) returns zero. It doesn't. It returns 0.1 or something similar. I've attached a file showing the odd results that Calc produces at present. I don't think it is seriously trying to evaluate rationals - it's more likely a byproduct of the method of calculating with integers. No user could/should have relied on this behaviour - so I'd suggest we would be perfectly safe to abandon any pretence and simply truncate any non-integer arguments as Excel does. We'd then be left with whether to calculate with negative integers and mixed pos/neg integers. Unfortunately this behaviour could have been relied on by users, so I think we are stuck with it. I'd be pleased if you disagreed... Gnumeric says its GCD function is the same as Excel, so it could be that Calc is then the only one marching in step. I'd suggest that negative numbers are truncated = rounded towards zero so that GCD(3.5;12) and GCD(-3.5;-12) both return 3. And if we clean up GCD_ADD so that it returns appropriate errors and mimics Excel by being Calc new GCD without the negative arguments will we be home and dry on this one? - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 User drking changed the following: What|Old value |New value Attachment data| |Created an attachment (id= | |41844) Current GCD behavio | |ur for non-integers --- Additional comments from [EMAIL PROTECTED] Wed Jan 3 00:41:47 -0800 2007 --- Created an attachment (id=41844) Current GCD behaviour for non-integers - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 --- Additional comments from [EMAIL PROTECTED] Tue Jan 2 10:48:25 -0800 2007 --- As for sign convention, I guess I don't have a big problem with the convention, "mixed signs returns negative GCD, same sign returns positive". It has a certain symmetry. To extend to an arbitrary number of arguments, use even/odd parity. I think this is what the current implementation does -- if so, the documentation needs to be clear. As for nonintegers, Mathworld defines it for rationals, which makes mathematical sense to me. Under that definition, GCD(1.2;2.4) = GCD(1.2;3.6) = 1.2. It may be that the implementor was trying for something along these lines, but didn't get all the way there. I worry about the difficulties (both for the implementor and potential users) of the definition on noninteger rationals, because rounding in the conversion between binary floats and decimal representations may cause unexpected results. Ditto for doing integer arithmetic algorithms on floats. We'd have to be very careful about defining and testing the behavior, but without a clear idea of who'd use it. This isn't a problem for symbolic math packages like Mathematica which know about rational numbers. Another source to check is the OpenFormula specification-in-development, available from http://www.oasis-open.org/committees/documents.php?wg_abbrev=office-formula . It appears to follow the OO documentation, so it will likely need updating as well. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 --- Additional comments from [EMAIL PROTECTED] Mon Jan 1 22:47:34 -0800 2007 --- Perhaps it would be useful to talk to whoever implemented this function, if that is possible, to find out the thinking behind it? There is another function GCD_ADD which should be the same as GCD in Excel; one of the differences with Calc GCD is that Calc GCD can handle negative numbers. If there is to be a difference between Calc and Excel I suppose this is a good one, and returning a negative number when the arguments have mixed signs is at least defined, even if not in maths textbooks. I'm not very convinced though. Note that Calc GCD(0,0) currently returns an error so this probably needs fixing too (Excel does manage a 0 here). Also note that GCD_ADD(A1;A2) where: A1="text", A2=2 returns 2; A1=2, A2="text" returns error; A1="text", A2=-2 returns error; A1="text", A2 blank returns 0; A1 blank, A2 blank returns 0; so there is some inconsistency that should really be fixed. I think all these should return errors as in Excel. [Calc GCD(A1;A2) works OK here] There seem to be different mathematical definitions of the GCD function. MathWorld http://mathworld.wolfram.com/GreatestCommonDivisor.html is usually reliable. But it talks about the Mathematica implementation that deals with non- integers. That might be useful to imitate? It seems to me that we could do with a maths specialist to help decide what is really wanted. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 User dridgway changed the following: What|Old value |New value Ever confirmed| |1 Status|UNCONFIRMED |NEW Keywords| |oooqa --- Additional comments from [EMAIL PROTECTED] Mon Jan 1 17:03:11 -0800 2007 --- Excel's documentation for GCD() states that Excel truncates to integers before applying, this approach makes sense to me. Zero shouldn't be the answer unless both a and b are zero: see http://en.wikipedia.org/wiki/Greatest_common_divisor. Excel also fails on negative integers, but GCD seems well defined for negative integers. However, Calc will return negative results sometimes; I'm not sure that's a good idea. I'd suggest always returning the positive GCD, regardless of the signs of the arguments. - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sc-issues] [Issue 71158] Inconsistent GCD() results for non-integers
To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=71158 Issue #|71158 Summary|Inconsistent GCD() results for non-integers Component|Spreadsheet Version|OOo 2.0.4 Platform|PC URL| OS/Version|Windows XP Status|UNCONFIRMED Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P4 Subcomponent|ui Assigned to|spreadsheet Reported by|drking --- Additional comments from [EMAIL PROTECTED] Fri Nov 3 07:41:49 -0800 2006 --- Example =GCD(1.2;2.4) returns 1.2 =GCD(1.2;3.6) returns 0 You could say that anyone using GCD with non-integers deserves this but the behaviour really ought to be defined consistently - returning an error or zero. It should never return a non-integer, or we might have GCD(5;6) giving 1.2 - Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]