- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
ot*"0.Frist"
Good thing is that even discount percentages like 1000% wouldn't make the final price negative...
Admin
Lame
Additional text to avoid spam filter
Admin
Admin
The "frist" strategy is to be logged in, writing a comment as fast as you can and the edit it later to something less embarrasing.
Admin
TRWTF is that some people shouldn't be allowed near anything that requires 9th grade mathematics skills. This isn't even algebra.
VB? How am I not surprised? (It was either that or PHP.)
Admin
Which makes every poster of any top comment a loser by default.
Admin
The person who wrote that had the right buzzwords on their CV - they'd played with the right toys.
And they probably had nice personalities as well and came across well at their interviews.
Of course using string conversion is a total WTF. That the code also doesn't work actually gives him grounds to change it, so perhaps better than if it were written correctly.
The code appears to not work because they forget that you need 2 digits to represent the percent so it is giving a discount of 0.5 when it should be 0.05?
Admin
I digress...but, why is it most of the more horrendously stupid WTFs are written in VB? I have never really understood it.
Admin
I wonder what would have happened if the original programmer would have fixed this bug: Would he have added a few PadLeft and IndexOf calls, and a regular expression or two for good measure? ;-)
Admin
Yes people, the code is awful, but it at least is written in a way that's supposed to calculate the right amount (except when it fits Cbuttius' example). If you feed it a 10% discount or higher it will perform correctly.
It's the stupider, bug-prone route to the right place.
Admin
Admin
Yes, of course this code is to blame.
If O.DiscountPercentage is lower than 10, then the calculated discount will off by a factor of 10.
If O.DiscountPercentage contains a decimal point (e.g. "10.5"), the digits behind it will be lost.
If O.DiscountPercentage is negative, then "0." & Convert.ToInt32(O.DiscountPercentage) will result in nonsense.
Admin
It won't work with a 100% discount.
Admin
[quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this.
Admin
Also, it is (or was, rather, guess today it is JavaScript) used in many schools for computer science lessons.
Admin
This sounds like a beginning of a journey... Cant wait for chapter 2 to come!
Admin
But dividing by 100 is HARD!
captcha: nobis, as in this person had nobis getting anywhere near a computer.
Admin
Admin
In the final stages, they talk about writing a gui in VB to trace an IP.
Admin
Just back from the trauma center, no further comments.
Admin
Or any percentage with a decimal, like 33.33%
Admin
Inefficient, too.
Had a teacher one time that assigned us to minimize parenthesis in something like this:
My response:
Whereupon he objected lamely that division was inefficient...but he gave in when I pointed out that the whole objective of the problem was to get rid of parenthesis.
Admin
[quote user="very punny"][quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this. [/quote]
This int what I was expecting. I object that they string me along just for a punchline like that! I'll have to double my efforts to come up with a suitable array of ripostes.
Admin
It's been a Short while.
Admin
[quote user="very punny"][quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this. [/quote]
I would string up the developer who did this
Admin
How is it that no one had noticed a problem with discounts less than 10% for so long?
Admin
Admin
Scam alert #1, for you naive youngsters, just in time for the holidays: jewelry stores price their $1000 rings at $2000 then give you "50% off", so you can impress your girlfriend how much you're (not really) spending on her. The problem is, she's much more tuned in to jewelry prices than you are, having spent 20 years now obsessing on the topic. So you're really not fooling her.
Scam alert #2: once you do buy that ring, and complete the related ceremonies, you can start counting down on one hand how many more times in your life you're going to get laid by a hot chick instead of a grudging grump.
Admin
And if O.DiscountPercentage is 100 or greater, the calculated discount will be too small.
Admin
Someone's going to pull some double shifts. It's going to get a bit hectic. But stuff like that builds character. It shows class. Nothing to object to.
Admin
Admin
And case sensitivity. Which is the biggest WTF in any programming language.
Admin
Admin
[quote user="very punny"][quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this. [/quote]
Your String of data type puns disgusts me.
Admin
I imagine a modern compiler's optimizer will reduce your code to something more efficient. It's not your father's Fortran anymore.
Admin
Admin
Admin
I'm not sure "copypasta" means what Mark thinks it means.
Admin
Admin
Hopefully he didn't have a short temper...
Admin
[quote user="eek"][quote user="very punny"][quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this. [/quote]
Your String of data type puns disgusts me.[/quote]Sadly, these unsigned comments always follow the same template. Let's go booling.
Admin
Did you read "case" as "culture"?
Admin
Well, this guy obviously remember the dictum to never use floats for currency... and picked precisely the wrong solution.
Remember when people who should have known better would earnestly claim that javascript had no addition, and that eval(a+"+"+b) was the only way to do it? Because they screwed up and didn't convert strings from the webform into ints, of course.Admin
Case-folding depends on the locale.
Admin
[quote user="very punny"][quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this. [/quote]
Ha, ha. Very guid.
Admin
eval is evil. The right way to add in JavaScript is
Admin
why can't you drop the parnthesis around D*E as well? Is it because of overflows?
Admin
Admin
Admin
[quote user="Spudley"][quote user="very punny"][quote] but one thing was for certain - this was going to be a long<!--Get it? Long...Decimal... When was the last time you saw a data type pun?--> week. [\quote]
He was going to need to use a float-ing holiday after this. [/quote]
This int what I was expecting. I object that they string me along just for a punchline like that! I'll have to double my efforts to come up with a suitable array of ripostes. [/quote]
for real?