[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

*Subject*: **Comment on ODF 1.2 OpenFormula (6.17 Rounding Functions)**

*From*:**Andrea Pescetti <pescetti@openoffice.org>***To*: office-comment@lists.oasis-open.org*Date*: Tue, 03 Aug 2010 23:26:24 +0200

6.17.1 General reads: --- Rounding functions convert an arbitrary Number into an Integer. --- This is mostly false. Indeed, only INT() converts to an Integer, while all the other functions listed allow to specify parameters that can lead to non-Integer results. 6.17.2 CEILING contains: --- If mode is given and not equal to zero, the amount of N is rounded away from zero to a multiple of significance and then the sign applied. --- This is unclear at best: 1) "the amount of N", as far as I know, has no mathematical meaning. No such term is listed at http://mathworld.wolfram.com/letters/A.html that is a standard reference for mathematical terminology. 2) I assumed, using "and then the sign applied" as a hint, that "the amount of N" means "the absolute value of N" in this context; but then, "a multiple of significance" does not make sense for negative values of "significance" (the "absolute value of significance" might need to be used). On the contrary, if "the amount of N" means simply "N", then the sentence "and then the sign applied" does not make sense. So I get a contradiction for any interpretation I can give. 6.17.4 FLOOR suffers from the same problem. If there is some mathematical identity that can be used to define FLOOR based on CEILING I strongly recommend using them instead. 6.17.7 ROUNDDOWN says: --- If Digits is zero, or absent, round to the largest decimal integer smaller or equal to X. --- which is against the informal specification and actually wrong. With this definition, one would have ROUNDDOWN(-10.33) = -11 while it is absolutely clear that the expected result in this context is ROUNDDOWN(-10.33) = -10. 6.17.8 ROUNDUP suffers from the same problem. 6.17.9 TRUNC states: --- Truncate number a to the number of digits specified by b. If b is zero, or absent, truncate to a decimal integer. If b is positive, truncate to the specified number of decimal places. If b is negative, truncate to the left of the decimal point. If b is not an integer, it is truncated. --- where it is possibly wrong (at least, it is inconsistent with what OpenOffice.org does) to say "If b is not an integer, it is truncated" for negative values of b. According to the definition, one would have TRUNC(123.456;-1.2)=TRUNC(123.456;TRUNC(-1.2))=TRUNC(123.456;-1)=-120 while OpenOffice.org gives TRUNC(123.456;-1.2)=-100. Since I don't know who is wrong, this comment has also been reported in the OpenOffice.org issue tracker: http://qa.openoffice.org/issues/show_bug.cgi?id=113628 All comments refer to the version of OpenFormula currently under public review as per http://lists.oasis-open.org/archives/tc-announce/201007/msg00004.html Regards, Andrea Pescetti - Italian N-L Project Lead, OpenOffice.org

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]