# OK, so we've seen these kind of &quot;numbers&quot; before

• ## decimal Zero = 0.0M; decimal One = 0.0M; decimal Var = 0.0M; [snip] if( Zero == decimal.MinValue || One == decimal.MinValue ) Var = decimal.MinValue; else Var = Zero - One;

I'm barely finding this stuff funny anymore.

• This is the first thing I've seen in a while that actually made me pause and puzzle for a minute to figure out what the Hell the coder was thinking.

If "zero" (0.0M) or "one" (0.0M) is the minimum value for decimals, set var to the minimum value for decimals, otherwise set it to zero minus zero (aka, "one").

WTF.

• May God have mercy on the person who wrote this.

This makes implementing a recursive greater-than operator look sane.

function gt(n, m) { return n == 0 ? false : m == 0 ? true : gt(n - 1, m - 1); }

• @djork said:

function gt(n, m) { return n == 0 ? false : m == 0 ? true : gt(n - 1, m - 1); }

I like what happens when you use negative numbers.

• The values for Zero and One actually do get changed somewhere in the [snip] section. Finally figured out what they were for.

One stores a piece of data from 1 year ago; Zero for the current year's data (0 years ago). Even so, improved naming scheme, please.

• @djork said:

function gt(n, m) { return n == 0 ? false : m == 0 ? true : gt(n - 1, m - 1); }

I think this looks better in Scheme:

(define gt (lambda (x y) (if (or (eq? x 0) (eq? y 0)) (and (not (eq? x 0)) (eq? y 0)) (gt (- x 1) (- y 1)) )))

usage: (gt x y)

Notes:

-Behavior fixed to be greater than instead of greater than or equal to.

-Desired business logic for negative numbers preserved.

• @PerdidoPunk said:

@djork said:

function gt(n, m) { return n == 0 ? false : m == 0 ? true : gt(n - 1, m - 1); }

I think this looks better in Scheme:

(define gt (lambda (x y) (if (or (eq? x 0) (eq? y 0)) (and (not (eq? x 0)) (eq? y 0)) (gt (- x 1) (- y 1)) )))

usage: (gt x y)

Where do you think I got it from?

@PerdidoPunk said:

-Behavior fixed to be greater than instead of greater than or equal to.

And now knowing where I got it from, you can assume I did NOT, in fact, make that mistake.  Try it.

@PerdidoPunk said:

-Desired business logic for negative numbers preserved.

Are you saying that you meant to keep the infinite loop when both numbers are negative integers?

• gt( 2, 2 ) == True

That's greater than or equal ..

• @Monkios said:

gt( 2, 2 ) == True

That's greater than or equal ..

Absolutely.  What's your point, exactly?  My code works like so:

gt(2, 1) => true

gt(2, 2) => false

gt(1, 2) => false

• @joe.edwards@imaginuity.com said:

I like what happens when you use negative numbers.

Or floating-point numbers.

• @djork said:

function gt(n, m) { return n == 0 ? false : m == 0 ? true : gt(n - 1, m - 1); }

Read that wrong on first glance.

@djork said:

Are you saying that you meant to keep the infinite loop when both numbers are negative integers?

Of course. It's a feature, not a bug. You can't argue with business logic.

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.