|
Did you try this:
double y0 = -0.0;
double y1 = 1 / y0;
Does it give +nfty or -nfty?
I ask because your x1 looks like this to me:
double x1 = -1 * 1 / 0.0;
Greetings - Jacek
|
|
|
|
|
That should give Negative Infinity, and it does.
|
|
|
|
|
Horror accepted.
Greetings - Jacek
|
|
|
|
|
Feds are gonna investigate and file a report on whoever has done this heinous crime ...
|
|
|
|
|
You know that feeling when you do something stupid and don't realize it until you've beat your brain to mush trying to fix it?? Yeah, try this on for size. Creating a converter to import images from a database (.BMP of all things!!) to something a bit more DB and web friendly, like PNG. Of course, I want to see the resulting images:
using (Bitmap newBitmap = targetBytes.ToBitmap())
{
...
TargetPictureBox.Image = newBitmap;
...
}
The targetPictureBox just showed a nice big red X. For 2 hours I couldn't figure out why this code worked yesterday but didn't work today! I accidently put the using block around the wrong bit of code!
|
|
|
|
|
Dave Kreskowiak wrote: The targetPictureBox just showed a nice big red X. For 2 hours I couldn't figure out why this code worked yesterday but didn't work today!
I was hoping the reason was going to be "the picture was a big red X". Oh well. (Then again, if that was the case, it wouldn't quite belong here I guess.)
|
|
|
|
|
I was looking to a web site that a team mate developed and found this briliant function
<script type="text/javascript">
function callPostBack() {
if (1 == 2)
return true;
else
return false;
}
</script>
What would you say to that "developer" ?
|
|
|
|
|
well, considering the language, i can't bash him...
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
"Given the chance I'd rather work smart than work hard." - PHS241
"'Sophisticated platform' typically means 'I have no idea how it works.'"
|
|
|
|
|
I'd say since it's JavaScript, use === instead of == .
/ravi
|
|
|
|
|
Good call.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I would possibly mention it to him in passing.
I have learned to no longer ridicule code no matter how idiodic that it appears, because I may just be belittling the code to the person that wrote it. Plus, I have come across my own mistakes that appear almost as brilliant as the example you have posted. I can only imagine started an idea, and never returned to that piece of code.
To know and not do, is not yet to know
|
|
|
|
|
Looks like code intended for debugging.
|
|
|
|
|
agreed
I do not fear of failure. I fear of giving up out of frustration.
|
|
|
|
|
I would ask why first? Perhaps there used to be a condition they were checking for and then at some point found out they didn't need it. It's easier to modify this one function then stop calling it from everywhere it could be used.
I would have expected a comment in it though, if that were the case.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
"What kind of debugging technique it is?" That's my first thought.
During debugging I would routinely put code like this to make debugging easier:
if(i == 4)
i = 4;
or
if(n == nullptr)
i = i;
|
|
|
|
|
Exactly.
Good and Bad code are created one line at a time.
This happens to be a chunk of forgotten code.
To know and not do, is not yet to know
|
|
|
|
|
Mladen Janković wrote: if(i == 4)
i = 4;
Was "4" chosen by a fair dice roll[^]?
Greetings - Jacek
|
|
|
|
|
Well, to take a point from a previous thread, it has one too many return statements.
Ducks and runs for cover.
At least I stay consistent.
Mark "So old school, Socrates was in his first year teaching." Johnson
Don't like the shot clock, the three point shot, or the designated hitter either.
|
|
|
|
|
MarkTJohnson wrote: one too many
It's much worse than that; it has fully twice as many as required!
|
|
|
|
|
Yes, it does have twice as many as needed.
He gets paid by the code line.
Then, when time comes to refactor and he gets paid by reducing the number of code lines, it's a double-paycheck score.
|
|
|
|
|
Bingo!!! Where is such company that pays that way... Can I have address and name of HR and name of the bar she frequents after work?
|
|
|
|
|
What the heck were you drinking that day mate?!
|
|
|
|
|
This look like obfuscators's poop... Obfuscator creates this kind of code all over the place ...
|
|
|
|
|
private void Frobinate()
{
string result = CreateRecord();
if (result == "")
{
}
else
{
if (MessageBox.Show("Record already exists. Do you want to update it?", MessageBoxButtons.YesNo) == DialogResults.Yes)
{
UpdateExistingRecord();
}
}
}
private string CreateRecord()
{
try
{
return "";
}
catch (Exception e)
{
return e.Message;
}
}
This pattern is absolutely brillant because nothing else could ever cause a problem. Authentication can never be incorrect. The server can never be down. Bob can never be taking a break to oil the hamster wheels.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Give the guy a break. At least he did try.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|