OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

# office-comment message

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

Subject: RE: [office-comment] Error in FLOOR function specification

• From: "Dennis E. Hamilton" <dennis.hamilton@acm.org>
• To: <office-comment@lists.oasis-open.org>
• Date: Thu, 19 Feb 2015 16:46:34 -0800

```Hi Joel,

Let's simplify this as it applies to having integer results:

Floor(x) is the largest integer not greater than x.  So if x is negative, the result is either x or a smaller number than x (i.e., away from zero).  It is the floor for positive x that tends to be toward zero if not the same as x.

Ceiling(x) is the smallest integer not less than x.  The rest can be filled in.

Important relationships are that floor(-x) = -ceiling(x)

And that when floor(x) = ceiling(x), x is an exact integer.

In OpenFormula, there are modifications because the functions are defined in a way that the result can be rational (typically, multiples of some constant).

I suspect that it would have been more direct to rely on the equivalent form of the above identities to keep everything straight.  There are mode differences too, of course that stray from the mathematical practice.

- Dennis

PS: There is more about this on pp. 39-41 (section 1.2.4) of "The Art of Computer Programming, vol. 1 Fundamental Algorithms."

-----Original Message-----
Sent: Thursday, February 19, 2015 14:27
To: office-comment@lists.oasis-open.org
Subject: [office-comment] Error in FLOOR function specification

Hello Committee Members,

I recently came across the OpenDocument 1.2 specification for the
FLOOR function (section 6.17.3), and I believe there is a small error
in the definition
that is deserving of some errata for clarity.  It reads as follows:

...If mode is given and not equal to zero, the absolute value of N is
rounded away from zero to a multiple of the absolute value of
significance and then the sign applied . Otherwise, it rounds toward
negative infinity, and the result is the largest multiple...

I believe that "away from zero" is a typo, and should be "toward
zero".  Compare to the CEILING (6.17.1) function definition:

...If mode is given and not equal to zero, the absolute value of N is
rounded away from zero to a multiple of the absolute value of
significance and then the sign applied . If mode is omitted or zero,
rounding is toward positive infinity; the number is rounded to the
smallest multiple...

Note that the FLOOR function, which should be the opposite of CEILING,
correctly specifies negative instead of positive infinity, but still
has "away from zero" like CEILING, when I believe it should be the
opposite.

An additional proposal: the FLOOR function language should be
conformed to the CEILING language, which I believe is clearer.
Namely, replace "Otherwise, it rounds toward negative infinity, and
the result is the largest multiple..." with "...If mode is ommitted or
zero, rounding is toward negative infinity; the number is rounded to
the largest multiple...".

--
This publicly archived list offers a means to provide input to the
OASIS Open Document Format for Office Applications (OpenDocument) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: office-comment-subscribe@lists.oasis-open.org
Unsubscribe: office-comment-unsubscribe@lists.oasis-open.org
List help: office-comment-help@lists.oasis-open.org
List archive: http://lists.oasis-open.org/archives/office-comment/