[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [office-formula] IMSUB and portable?
Patrick asked: > "A portable way to test equality is to use IMSUB to compute the > difference, use IMABS to find the absolute difference, and then ensure the > absolute difference is smaller than or equal to some nonnegative value (for > exact equality, compare for equality with 0)." > I ask because if an evaluator allows a TEXT type, IMSUB accepts complex. If > the TEXT is not converted into Complex, then how it this a portable test of > equality? Dennis Hamilton said: > I don't believe this should be a note. It can be removed. > > Any user guide can provide this. It is not necessary to the specification > or implementation of OpenFormula. > > The observation made in the note is a consequence of the (mathematical) > definitions of IMABS and IMSUB. Dennis is right, this does not need to be a note. It's just a consequence of the other definitions. I think this note was more important when we had lots of built-in test values; this is a portable way to see if a complex number is within some epsilon of the "correct" value. But we don't now, so its value is diminished. As a quick background, Text needs to be accepted as complex, as defined in the "Complex Number" section: "Functions and operators that accept complex numbers shall accept Text values as complex numbers (see the section on convert to complex), as well as Numbers that are not complex numbers, so IMSUM("3i";4) will produce the same result as COMPLEX(4;3). " Also, the definition for function COMPLEX has an error; its second parameter should be "Number" not "Complex". I put that in as part of: http://tools.oasis-open.org/issues/browse/OFFICE-2344 --- David A. Wheeler