torkell: (Default)
[personal profile] torkell
Now here's a question for you:

When is 50 greater than 300?

Hint: This is VB, and I have a textbox containing 50 and a textbox containing 300, and am comparing them with Text1 > Text2.

Date: 2005-06-20 07:26 pm (UTC)
From: [identity profile] pleaseremove.livejournal.com
Where the units for the 50 is elephants and the units for the 300 is chiwawas. and the comparison unit is weight.

Why do you persist in asking such simple questions?

Date: 2005-06-20 07:35 pm (UTC)
From: [identity profile] olego.livejournal.com
Without the hint it would've been too ambiguous; but with the hint it's too obvious. I think JavaScript is even more stupid about it than VB.

Date: 2005-06-20 08:16 pm (UTC)
From: [identity profile] ralesk.livejournal.com
perl forever. > and gt rox0r y0r box0r.

2+2=5 (for extremely high values of 2)

Date: 2005-06-21 12:26 am (UTC)
From: [identity profile] drkl1ght.livejournal.com
I think that it's comparing them not as numbers, but as strings. "5" comes after "3", so it doesn't even check the next character.

Re: 2+2=5 (for extremely high values of 2)

Date: 2005-06-21 12:27 am (UTC)
From: [identity profile] drkl1ght.livejournal.com
But I figure you've already realized that.

Date: 2005-07-01 09:51 pm (UTC)
From: [identity profile] katayamma.livejournal.com
Integer vs Strings.

Yes, young padiwan, this is a common error made by many a programmer.

I come from the old school where you declared EVERY varaible type and convert numeric strings before doing ANYTHING to them.

Sloppy programming like what you encountered is why M$ is constantly having to publush patches. They tend to assume that the compiler will make everything good and right, when the truth is that it won't. The compiler cares nothing about what you want, only about how the code's written, and even then, what you THINK you wrote may not be what you really wrote. :P

Cheers

January 2026

S M T W T F S
     123
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 7th, 2026 10:48 pm
Powered by Dreamwidth Studios