| « Prev | Page 1 | Page 2 | Next » |
Re: Multiplying Strings
2012-12-06 17:17
•
by
PRMan
(unregistered)
|
|
But a 5% discount becomes a 50% discount! Probably the bug in question.
|
Re: Multiplying Strings
2012-12-06 17:50
•
by
C-Derb
(unregistered)
|
FTFY |
Hehe, just messing with you. I've read the arguments on both sides, and I'm an ardent supporter of making my own life easier. |
Re: Multiplying Strings
2012-12-06 18:02
•
by
valdik
(unregistered)
|
|
[quote user="uns"][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?[/quote] Yeah, I would object. |
|
Especially since the majority of code, whether you want it like that or not, is English:
http://msdn.microsoft.com/tr-tr/library/0x9tb07z(v=vs.80).aspx |
Re: Multiplying Strings
2012-12-06 18:36
•
by
foo
(unregistered)
|
Me too, and since using the same identifier with different case is very bad style to me, I'm happy that my compiler (C++) tells me when I get it wrong. |
Re: Multiplying Strings
2012-12-06 18:38
•
by
foo
(unregistered)
|
Thanks for supporting my side (case-sensitivity). Think about it: Code written in Turkish works OK in a Turkish locale (obviously). But code written in English will fail there if case-insensitive. |
That's just semantics. And it's up to the developer to realize that. The combination of the English programming vernacular and VB both being case-insensitive make it superior. Especially when combined with how well Visual Studio manages it real-time, so you don't have to. I honestly believe that case-sensitive languages, whether it be a programming language like C#, or a language like Turkish, are extremely flawed. |
Re: Multiplying Strings
2012-12-06 19:02
•
by
Neveralull
(unregistered)
|
You didn't edit this one very well |
Re: Multiplying Strings
2012-12-06 19:08
•
by
punny too
(unregistered)
|
|
I'll take your WORD on it.
|
Re: Multiplying Strings
2012-12-06 19:14
•
by
foxyshadis
(unregistered)
|
You also could have converted to postfix and really made his day. |
Don't you mean: "Please attempt some case-sensitivity: I had a compiler that was non-case-sensitive, and let me assure you it is no laughing matter." |
Re: Multiplying Strings
2012-12-06 19:41
•
by
gnasher729
(unregistered)
|
Problem is that replacing a / b / c with a / (b * c) for floating-point numbers will most likely change the result due to rounding errors, which makes it illegal to do in many languages (like C, C++, Java, Objective-C). |
Re: Multiplying Strings
2012-12-06 20:50
•
by
i can has string concat
(unregistered)
|
|
The problem is that there are a bunch of so-called programmers who learned how to do string concatenation on day 1, and then go on to apply it everywhere for the rest of their career.
Where I work, we have one guy who does string concatenation in SQL to return a HTML select, and another who does string concatenation in javascript to do date arithmetic. |
Re: Multiplying Strings
2012-12-06 21:01
•
by
foo
(unregistered)
|
Sorry, that was a little too much. Until you wrote that I considered you might not be trolling. (Though the use of VB and superior in the same sentence above should have been a give-away.) |
Re: Multiplying Strings
2012-12-06 21:05
•
by
Darth Paul
(unregistered)
|
Worse: there are programmers out there who don't realise they are working with case-sensitive language (when it is optional). A common error in SQL Server development projects is to install SQL Server as case-insensitive, then write case-insensitive code, thereby risking that said code will not compile on systems where SQL Server is installed case-sensitive. A major WTF: case-insensitive is the "default" SQL Server installation state, binary (case-sensitive) is the "recommended" configuration state. Most projects I have seen (including major open source projects) have programmers that have not read that part of the manual. |
|
can anyone explain it, is there something wrong with the code? I dont get it.
|
Re: Multiplying Strings
2012-12-06 23:31
•
by
foo
(unregistered)
|
Hint: There's a "page 1" link below. And surprisingly, this link leads to a full page of previous comments, some of which even related to the current WTF. |
|
Maybe I'm an ignorant savage, but I have a JavaScript program that needs to truncate a (float) number to integer. There is no such JavaScript function. All JavaScript integers are floats. The only way I've figured out how to do it is to convert X to a string and parse the string up to the decimal point.
var I = parseInt( X.toFixed(3)); Argh! |
And with that, I experience yet another flashback to all those times I was told "that'll never happen, so it doesn't matter what you do for that case". My usual response to that sort of guidance is "in that case, I'll arrange to code it so that if the thing you say will never happen does happen, it's okay to call you at your personal unlisted number any time of the day or night". They seldom agree to this. They never agree to it a second time. |
Re: Multiplying Strings
2012-12-07 01:42
•
by
Drak
(unregistered)
|
Math.floor(X); // takes off everything beyond the decimal point. |
Re: Multiplying Strings
2012-12-07 01:46
•
by
foo
(unregistered)
|
Not for negative numbers if it's like floor() in most other languages. |
Re: Multiplying Strings
2012-12-07 01:55
•
by
Jeff Grigg
(unregistered)
|
|
Ant that is TRWTF. >;->
|
Re: Multiplying Strings
2012-12-07 01:56
•
by
Jeff Grigg
(unregistered)
|
And that is TRWTF. (Sorry for the earlier typo! WTF?!? ;-) |
Re: Multiplying Strings
2012-12-07 01:58
•
by
Jeff Grigg
(unregistered)
|
And given that it's been wrong like that for... HOW LONG?!? What makes it such a big crisis *RIGHT NOW*?!? |
|
[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] If he was union-ized, he could do all the type punning he wanted. |
There, fixed that for you |
Re: Multiplying Strings
2012-12-07 06:40
•
by
Stuart Longland
(unregistered)
|
|
[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] Hmmm, enough to drive me to drink... better make it a double! |
Re: Multiplying Strings
2012-12-07 08:31
•
by
LonesomeProgrammer
(unregistered)
|
Smart people know VB is generally not a very good choice of language, so they stay away from it as much as possible. Stupid people don't, so they will program in whatever they can. I think I can safely assume that stupid people create more WTFs than smart people, therefore combining these two will result in the proposition that VB code will generally contain more WTFs than code written in a language such as Java or C#. Call me arrogant or narrow minded, but the reality really is not much more complicated than that. |
Yes, dividing is generally takes more time than multiplying, so instead of dividing by 100, multiply by 0.01 instead. Problem solved. |
Re: Multiplying Strings
2012-12-07 12:05
•
by
gnasher729
(unregistered)
|
|
[quote user="Nutster"][quote user="RRDY"]But dividing by 100 is HARD![/quote]
Yes, dividing is generally takes more time than multiplying, so instead of dividing by 100, multiply by 0.01 instead. Problem solved.[/quote If that would solve the problem, the compiler would do it for you. When you write 0.01, you don't get 0.01 but a floating point number very close to but not exactly equal to 0.01. If you multiply let's say 3700 by that number, the result before rounding isn't 37 but some number close to but not exactly equal to 37. Rounding _may_ round to 37, but isn't guaranteed to. All kinds of funny things may happen as a result. |
Re: Multiplying Strings
2012-12-07 12:33
•
by
bob
(unregistered)
|
|
no--you're wrong
|
Re: Multiplying Strings
2012-12-07 13:27
•
by
Kirby L. Wallace
(unregistered)
|
|
But hey! At least he should get double time overtime pay!
|
Re: Multiplying Strings
2012-12-07 14:48
•
by
Osman
(unregistered)
|
|
On the double!
|
The WTF in that last statement is that you didn't realize that they purposefully f*cked it up in order to get people to talk about it and watch to try and locate more screw ups. Pretty good marketing actually. MS would pay them for mentioning VB; meanwhile it's self serving. |
Re: Multiplying Strings
2012-12-07 16:34
•
by
Shinobu
(unregistered)
|
|
A lot of people still don't realise this, but most operations, including division take just one tick. The real performance issues are caused by cache misses and page faults.
As for the case thing, case-sensitivity is bloody annoying. It says something that IDEs for case-sensitive languages almost always have a way to mitigate it and fix the case. |
Re: Multiplying Strings
2012-12-07 18:55
•
by
Meep
(unregistered)
|
Being innumerate should be as socially unacceptable as being illiterate. |
Re: Multiplying Strings
2012-12-08 01:25
•
by
Norman Diamond
(unregistered)
|
It might be services instead of products. I had a stock transaction where the commission was discounted by 200%. It surprised me, but it looked like it was intentional on the part of the broker because of their rules. Even if that happened more than once I wouldn't get rich on it though. It might be something other than services or products too. There have been a few cases where loans had interest rates around -0.005%. Ordinarily one would expect that the lender would be better off just keeping the cash, but someone explained that keepers of cash have to pay to store and guard the cash so the loan was better. |
Re: Multiplying Strings
2012-12-08 01:29
•
by
Norman Diamond
(unregistered)
|
In some societies being numerate is socially unacceptable, ranging from nerdishness to offensiveness. "Hey look, I had a fantastic game of golf." "You added up the numbers wrong. Here's your real score." "Well what do you want, a good mathematician or a good golfer?" "You're neither." "GTFO asshole." |
Re: Multiplying Strings
2012-12-08 05:29
•
by
old timer
(unregistered)
|
Because horrendously stupid WTFs in C are uninteligable except to experts, unnoticble except to LINT, and mostly never discovered even when they cause regular crashes. |
Re: Multiplying Strings
2012-12-08 05:42
•
by
old timer
(unregistered)
|
If it was your father's FORTRAN, it wouldn't need a modern compiler's optimizer to reduce your code to something more efficient. Modern copiler optimizers are designed to reduce your C code to something almost as efficient as your Fathers FORTRAN. And even that is possible only if you are using the C99 'restrict' keyword. |
Re: Multiplying Strings
2012-12-09 19:01
•
by
Norman Diamond
(unregistered)
|
Yes you would. If I recall correctly, IBM's Fortran G didn't even remove common subexpressions when accessing array elements and didn't do strength reduction in loop variables that traversed an array. Fortran H was designed to be better but it was funny when it wasted CPU time clearing unused portions of a register that were never accessed other than in clearing them. The Fortran standard restricted some kinds of expressions in ways that appeared unnecessary. The reason for the restrictions was that compiler writers knew ways to optimize some kinds of expressions, so the executable code could be nearly as fast as assembly. If arbitrary expressions were allowed, the executable code would be 10 times slower than assembly and no one would have switched to Fortran. |
Oh man, I hope he solves it by converting the string to a float, multiplying by 0.01f and writing the result to string. Next week we'll have a special "I got 5.79999999999999999999999999<snip>9999999999985% discount on this" Error'd edition. Personally, I'd take the percentage as a string in base-10, pad on the left with zeroes if needed and insert a '.' two characters before the end. |
|
dDiscount←ot×2⊃⎕VFI'0.',¯2↑'0',⍕O.DiscountPercentage
Fixed it for you |
Re: Multiplying Strings
2012-12-10 05:50
•
by
Punlicious
(unregistered)
|
|
You, sir, made my day. I wish more people were as int-elligent as you.
|
Re: Multiplying Strings
2012-12-18 03:05
•
by
Thomas Kolar
(unregistered)
|
|
[quote]
[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] That was an epic... double whammy, if I may say so. |
Re: Multiplying Strings
2012-12-18 23:00
•
by
Tortoise
(unregistered)
|
|
...Fifth grade? If that?
|
| « Prev | Page 1 | Page 2 | Next » |