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

 


Help: OASIS Mailing Lists Help | MarkMail Help

office-formula message

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


Subject: Re: [office-formula] Mathematical formulas - general


As used in OpenFormula, "Number" is a real number.  See, for example, 
section 4.2 or the BNF in 5.2. 

So functions that are declared to take parameters of type Number operate 
on real numbers only.  However, if a Complex number is passed to these 
functions, most implementations will convert the value" it into a Number, 
most-likely by dropping the imaginary part.

We see something similar with functions that expect an Number and are 
passed Text.  We could define the function ABS() as allowing Number or 
Complex or Integer or Boolean or Text.  But that gets messy and 
repetitive, since almost every function allows the same set of 
conversions.  So I think it is simpler to define the fewest number of 
parameter types for each function, and then define globally allowed 
implicit conversion operators that may be applied.

So ABS() takes a Number.  But wherever Text, Complex, Integer, etc., are 
passed to functions that expect a Number (are prototyped as taking a 
Number parameter) then the passed in values under gocanonical conversions 
to Number.

I think we have this material in the spec, but probably not stated as 
crisply and centrally as it should be.

-Rob

Patrick Durusau <patrick@durusau.net> wrote on 12/01/2009 08:06:59 PM:


> OK, the intro text reads:
> 
> > This section describes functions for various mathematical functions, 
> > including trigonometric functions like SIN <file:///SIN>). Note that 
> > the constraint text presumes that a value of type Number is a real 
> > number (no imaginary component). Unless noted otherwise, all angle 
> > measurements are in radians.
> >
> Err, what "the constraint text presumes that a value of type Number is a 

> real number (no imaginary component)."?
> 
> Ah, after taking a break, does this mean that N in the "constraints" 
> text of each function is supposed to be of type Number and a real 
number?
> 
> Err, ok, so what happens with ABS? "Constraints: None." Does that mean I 

> can apply ABS to a complex number? (it is defined but I suspect we mean 
> to exclude that and other definitions for absolute value).
> 
> Ouch. If true, two possible JIRA issues to file:
> 
> 1) Explicitly state that all functions in mathematical functions accept 
> N of type Number and real number. (Or do we define real number or a 
> source where we can simply cite it?)
> 
> 2) Once that is corrected, do we need to do anything about an 
> unconstrained ABS function?
> 
> Hope everyone is having a great day!
> 
> Patrick
> 
> 
> 
> -- 
> Patrick Durusau
> patrick@durusau.net
> Chair, V1 - US TAG to JTC 1/SC 34
> Convener, JTC 1/SC 34/WG 3 (Topic Maps)
> Editor, OpenDocument Format TC (OASIS), Project Editor ISO/IEC 26300
> Co-Editor, ISO/IEC 13250-1, 13250-5 (Topic Maps) 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this mail list, you must leave the OASIS TC that
> generates this mail.  Follow this link to all your TCs in OASIS at:
> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php 
> 



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