Excel Formula
Ragdyer wrote:
Care to comment on:
=LOOKUP(A1,{-9E+307,38,39,40,41;"Empty","One Quarter","Half","Three
Quarters","Full"})
Su try putting -9.9e307 into A1. Klunk!
Eventually, you will hit upon the smallest possible negative number --
at least, what you think is the smallest. But what happens to the
correctness of the spreadsheet when the world moves on to 128-bit
floating point as the "norm"? (The 80-bit and 128-bit formats are
already defined by the standard.)
(Hmm, I wonder how many spreadsheets and computer programs will fail
then anyway.)
I prefer to write formulas that always work -- unless there is good
reason for a short-cut. IMHO, if(cond,"",lookup(...)) is not so
complex that it deserves a short-cut that does not always work.
OTOH, if the OP states that A1 will never be less than zero, I would
agree that your original formuation is cleaner. The truth is: I had
intended to include it in my previous postings, with the proper
constraint duly noted, but I forgot. After I pushed "submit", I did
not think it was worth an addendum.
I think your original posting would have been just fine if you had
explicitly stated your assumptions (aka ass-u-me-tions ;-) for the
benefit of the hapless reader.
|