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


Help: OASIS Mailing Lists Help | MarkMail Help

office-comment message

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

Subject: OpenFormula - Types

Here are a few thoughts on OpenFormula types.
Can anyone correct me where I've messed up?

First, a cell can be empty, or it can contain a value.
Formulas ALWAYS return one value (which may be an "array" of values).

A value can be one of the following:
* A number.  This includes currency, date, etc., which
   are just formats of a number.  Numbers may be fractional.
* A string.
* A boolean.
* An error.
* A set of values.  Some formulas, like MMULT(), can
   return a set of values.

I've been doing a lot of fiddling and looking,
and determined that booleans are NOT the same as numbers.
Normally, a function expecting a number and getting a boolean
coverts the boolean to 0 or 1, so SUM(range_of_boolean) returns the count
of true values in both OOo and Excel.... so often it
appears that there's no separate boolean type.

But it's an illusion, there IS a separate boolean type,
as documented by the OOo docs on Excel and my own tests.
For example, in OOo ISLOGICAL(TRUE()) is true, ISLOGICAL(1) is false..
even if the "1" is in a cell that is formatted as a boolean.
There's even a minor error in OpenOffice.org's "ROMAN()"
implementation on this point. In Excel, function ROMAN(num, format)
produces a string representation of num, but exactly
what the string looks like is controlled by the
"format" value.  If format is 0..4, it produces various formats.
If the format value is TRUE(), this is the same as 0 (zero!),
and if the format value is FALSE(), this is the same as 4.
That's right, here TRUE()==0 and FALSE()==4, which only makes
sense if the function ROMAN() can first ask if the value is
a boolean or a number, and change behavior based on that
(this is documented in "Excel 2000 in a Nutshell", page 388-389,
though the oddity of the logical values isn't stressed...
*I*'m the one who noticed this extreme weirdness).
OOo acts as if TRUE() is 1 and FALSE() is 0, which it gets away
with because few probably use ROMAN() with that much concern about
the format anyway.... but someone MIGHT, and this is why this
stuff really needs to be specified... someone, somewhere will depend
on a particular behavior.

--- David A. Wheeler

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