[Sorry about the late response. I got busy.]
Jerry W. Lewis said:
You insist that ROUNDDOWN(x,3) rounds based on the exact binary
representation, but that cannot simultaneously explain the examples
that I have provided to back up my explanation. Can you find ANY
example where the Excel functions ROUNDDOWN(x,n), ROUNDUP(x,n),
ROUND(x,n), INT(x), etc behaves differently than if the argument were
VALUE(x&"")? I reached this explanation a number of years ago and
have yet to see anything that contradicts it.
I don't know of any examples that contradict your conclusion.
I did not provide any such examples because I was __agreeing__ with you.
At least, that was my intention. My intention was to describe what your
VALUE(A1&"") does, not to offer an alternative explanation.
But aha! I think I see the subtle difference in our wordings.
When A1 contains a number, VALUE(A1&"") converts A1 as Excel would do to
display the numeric cell value, namely up to 15 significant digits, rounding
the 16th significant digit.
(I am not saying that VALUE() per se does that. It is actually the
conversion of numeric A1 to text that causes the rounding.)
I was trying to say the same thing when I said "rounding the binary to 15
significant digits". I took "as Excel would do to display the numeric
cell value" for granted because in the form VALUE(A1&""), we are relying on
Excel to do the conversion, and I know of no way that Excel performs such
conversions other than "as [it] would to display the numeric cell value".
But I had not thought of other ways of performing the conversion, e.g. a UDF
that calls CStr.
So I agree: I erred in omitting "as Excel would do to display the numeric
cell value". That is more precise because it covers any defective
Excel conversions, e.g. the one described in
http://support.microsoft.com/kb/161234.
OK, then explain ROUNDDOWN(40000.846-2^-37,3)
If we enter =40000.846-2^-37 into A1, the exact internal representation is
40000.8459999999,9045394361019134521484375. In that case, VALUE(A1&"")
results in exactly 40000.8459999999,977299012243747711181640625, which is
the exact internal representation of 40000.846. So ROUNDDOWN returns the
binary representation of 40000.846 instead of 40000.845.
In contrast, if we enter =40000.846-7*2^-37 into A1, the exact internal
representation is 40000.8459999999,46798197925090789794921875. In that
case, VALUE(A1&"") results in exactly 40000.8459999999,03142452239990234375,
which is the exact internal representation of 40000.8459999999. So
ROUNDDOWN returns the binary representation of 40000.845, namely
40000.8450000000,0116415321826934814453125.
Based on those examples (and others that I have mentioned in this thread),
when A1 is numeric, VALUE(A1&"") appears to be rounding the internal binary
representation to 15 significant digits, no matter how you choose to
interpret that description.
(Again, it is actually the conversion of numeric A1 to text that causes the
rounding, not VALUE per se.)
But that simple description does not necessarily cover the defect in KB
161234, unless you realize that I meant to say "as Excel would do to display
the numeric cell value".
For example, if we enter 40000.848 into A1, the exact internal
representation is 40000.8479999999,9813735485076904296875. By visual
inspection and a literal interpretation of my description, we might expect
VALUE(A1&"") to result in the binary representation of 40000.848 again.
Thus, we would expect ROUNDDOWN(40000.848,3) to also return the binary
representation of 40000.848.
But VALUE(A1&"") actually results in
40000.8479999999,035499058663845062255859375, the binary representation of
40000.8479999999, because that is how the defective Excel display conversion
algorithm presents 40000.848 (in Excel 2003). So ROUNDDOWN(40000.848,3)
results in the binary representation of 40000.847, namely
40000.8470000000,015716068446636199951171875 because of the defective
display conversion.
In conclusion, I believe we are in violent agreement -- at least you are --
to wit: the Excel 2003 round and truncate functions [*] treat their
argument as VALUE(A1&""). That is, they round the argument to 15
significant digits, as Excel would do to display the numeric cell value,
before doing the appropriate round or truncate operation.
I believe the horse is turning over in its grave
.
-----
Endnotes
[*] I have not bothered to check Excel 2003 ATP round/truncate functions,
e.g. MROUND.
All comments and examples are for Excel 2003 11.5612.5606, part of MS
Office Sm Busn Ed 2003 on MS Win XP SP3. They may or may not apply to other
revisions of Excel 2003 and other versions of Excel.
All other disclaimers apply, implied and explicit. Void where prohibited by
law. "Don't tread on me". "Sell no wine before its time".
----- original message -----