Re: Here's one for you rick

Tech-Archive recommends: Speed Up your PC by fixing your registry



Rick Rothstein (MVP - VB) <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote:
(Maximum Of A and B) = (A + B + Abs(A - B)) / 2

(Minimum Of A and B) = (A + B - Abs(A - B)) / 2

Neat tricks. Puzzling out the math (average of the two plus or minus
half
the difference), it makes perfect sense, but I'd never thought of that
before, nor have I ever come across it anywhere until now. Very neat!

Cool trick, alright. But couldn't ever dream of being more efficent than
a standard comparison.

I agree... and sort of said so in a response Michael telling him not to use
the one-liner that is built around it.

Yeah, I noted that.

The only reason I used it was because Michael "challenged" me

Certainly reason enough! <g>

I actually liked my Format statement trick better (where I use the \0 to
force negative values to zero).

That was very cool too. I don't know if I've ever used that outside Excel, myself!
--
..NET: It's About Trust!
http://vfred.mvps.org


.



Relevant Pages

  • Re: Heres one for you rick
    ... Puzzling out the math (average of the two plus or minus half ... the difference), it makes perfect sense, but I'd never thought of that ...
    (microsoft.public.vb.general.discussion)
  • Re: Heres one for you rick
    ... Puzzling out the math (average of the two plus or minus half ... the difference), it makes perfect sense, but I'd never thought of that ...
    (microsoft.public.vb.general.discussion)
  • Re: Heres one for you rick
    ... Puzzling out the math (average of the two plus or minus half ... the difference), it makes perfect sense, but I'd never thought of that ...
    (microsoft.public.vb.general.discussion)
  • Re: JSH: Why factoring solution must work
    ... search space for v to the rationals. ... That is a mathematically false statement. ... Either you did the math wrong or selectively picked plus or minus at ...
    (sci.math)
  • Re: Poll - your 5 favourite living pianists
    ... So as a public service here tonight, I thought I would offer a brief lesson in the New Math. ... (And you know why four plus minus one ... So you look at the four in the eights place. ... silly question, ...
    (rec.music.classical.recordings)