torkell: (Default)
Thomas ([personal profile] torkell) wrote2005-06-20 08:16 pm

(no subject)

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.

[identity profile] pleaseremove.livejournal.com 2005-06-20 07:26 pm (UTC)(link)
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?

[identity profile] olego.livejournal.com 2005-06-20 07:35 pm (UTC)(link)
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.

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

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

[identity profile] drkl1ght.livejournal.com 2005-06-21 12:26 am (UTC)(link)
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)

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

[identity profile] katayamma.livejournal.com 2005-07-01 09:51 pm (UTC)(link)
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