Click here to Skip to main content
13,352,175 members (74,133 online)

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralWhen things to more than you think Pin
imagiro6-Aug-13 8:17
memberimagiro6-Aug-13 8:17 
GeneralRe: When things to more than you think Pin
Super Lloyd6-Aug-13 22:13
memberSuper Lloyd6-Aug-13 22:13 
GeneralUndoubtedly this is my own ignorance in glorious action but... Pin
Andy Bantly5-Aug-13 8:52
memberAndy Bantly5-Aug-13 8:52 
GeneralRe: Undoubtedly this is my own ignorance in glorious action but... Pin
Matt U.5-Aug-13 9:10
memberMatt U.5-Aug-13 9:10 
GeneralRe: Undoubtedly this is my own ignorance in glorious action but... Pin
Andy Bantly5-Aug-13 10:22
memberAndy Bantly5-Aug-13 10:22 
GeneralRe: Undoubtedly this is my own ignorance in glorious action but... Pin
Matt U.5-Aug-13 11:02
memberMatt U.5-Aug-13 11:02 
GeneralRe: Undoubtedly this is my own ignorance in glorious action but... Pin
Andy Bantly6-Aug-13 11:54
memberAndy Bantly6-Aug-13 11:54 
GeneralSo you think you know what double.Parse does? Pin
harold aptroot3-Aug-13 0:27
memberharold aptroot3-Aug-13 0:27 
I thought I knew, but I was wrong.
double x0 = 1 / 0.0;
double x1 = 1 / -0.0;
double x2 = 1 / double.Parse("0.0");
double x3 = 1 / double.Parse("-0.0");

Obviously these are all going to be some sort of infinity (yes you can divide by zero[^], and the result is infinity). One might reasonably expect both x1 and x3 to be Negative Infinity .. however, only x1 is Negative Infinity. x3 is Positive Infinity, which is about as wrong as any answer could possibly be.
This implies that double.Parse blatantly ignores the sign of zero.
GeneralRe: So you think you know what double.Parse does? Pin
PIEBALDconsult3-Aug-13 6:31
professionalPIEBALDconsult3-Aug-13 6:31 
GeneralRe: So you think you know what double.Parse does? Pin
Grimlock4-Aug-13 9:25
professionalGrimlock4-Aug-13 9:25 
GeneralRe: So you think you know what double.Parse does? Pin
harold aptroot4-Aug-13 10:07
memberharold aptroot4-Aug-13 10:07 
GeneralRe: So you think you know what double.Parse does? Pin
Grimlock7-Aug-13 8:38
professionalGrimlock7-Aug-13 8:38 
GeneralRe: So you think you know what double.Parse does? Pin
harold aptroot7-Aug-13 8:51
memberharold aptroot7-Aug-13 8:51 
GeneralRe: So you think you know what double.Parse does? Pin
Rob Grainger15-Aug-13 1:18
memberRob Grainger15-Aug-13 1:18 
GeneralRe: So you think you know what double.Parse does? Pin
Amitosh S.M.4-Aug-13 21:50
memberAmitosh S.M.4-Aug-13 21:50 
GeneralRe: So you think you know what double.Parse does? Pin
Jacek Gajek6-Aug-13 11:56
memberJacek Gajek6-Aug-13 11:56 
GeneralRe: So you think you know what double.Parse does? Pin
harold aptroot6-Aug-13 11:59
memberharold aptroot6-Aug-13 11:59 
GeneralRe: So you think you know what double.Parse does? Pin
Jacek Gajek6-Aug-13 12:15
memberJacek Gajek6-Aug-13 12:15 
GeneralRe: So you think you know what double.Parse does? Pin
ExcellentOrg21-Aug-13 1:07
groupExcellentOrg21-Aug-13 1:07 
GeneralFace, meet palm... Pin
Dave Kreskowiak2-Aug-13 10:45
mvpDave Kreskowiak2-Aug-13 10:45 
GeneralRe: Face, meet palm... Pin
lewax002-Aug-13 11:22
memberlewax002-Aug-13 11:22 
GeneralBest Function Ever Pin
LNogueira2-Aug-13 7:20
memberLNogueira2-Aug-13 7:20 
GeneralRe: Best Function Ever Pin
Sentenryu2-Aug-13 7:44
memberSentenryu2-Aug-13 7:44 
GeneralRe: Best Function Ever Pin
Ravi Bhavnani2-Aug-13 8:08
professionalRavi Bhavnani2-Aug-13 8:08 
GeneralRe: Best Function Ever Pin
ryanb312-Aug-13 9:03
memberryanb312-Aug-13 9:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 20 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid