Click here to Skip to main content
15,891,529 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Thought of the day Pin
W Balboos, GHB2-May-16 6:07
W Balboos, GHB2-May-16 6:07 
GeneralRe: Thought of the day Pin
PompeyThree2-May-16 8:21
PompeyThree2-May-16 8:21 
GeneralRe: Thought of the day Pin
Mandeep82-May-16 8:39
Mandeep82-May-16 8:39 
GeneralRe: Thought of the day Pin
Daniel Pfeffer2-May-16 22:24
professionalDaniel Pfeffer2-May-16 22:24 
GeneralWhat is Sign of 0? Pin
Marc Clifton2-May-16 4:53
mvaMarc Clifton2-May-16 4:53 
GeneralRe: What is Sign of 0? Pin
Ian Shlasko2-May-16 5:02
Ian Shlasko2-May-16 5:02 
GeneralRe: What is Sign of 0? Pin
Marc Clifton2-May-16 5:28
mvaMarc Clifton2-May-16 5:28 
GeneralRe: What is Sign of 0? Pin
Plamen Dragiyski3-May-16 2:39
professionalPlamen Dragiyski3-May-16 2:39 
Ian Shlasko wrote:
I'd like to know how they represent -0 internally...

That's exactly where is the problem. I don't know C# (I'm currently a javascript programmer), but a Number is internally stored as IEEE754 floating point, which have a bit for sign. It is not an integer. Zero can be represented without the sign bit, therefore when sign bit is 0, you get +0.0, when it is 1, you get -0.0. It is just a bit interpretation problem.

If you are interesting why -0.0 work as it is, there is very good mathematical theory for infinitesimals. But as a rule of a thumb, never use == on floating-point number. It returns false more often than you expect to.
GeneralRe: What is Sign of 0? Pin
User 48350472-May-16 5:07
User 48350472-May-16 5:07 
GeneralRe: What is Sign of 0? Pin
Marc Clifton2-May-16 5:29
mvaMarc Clifton2-May-16 5:29 
GeneralRe: What is Sign of 0? Pin
k50542-May-16 6:50
mvek50542-May-16 6:50 
GeneralRe: What is Sign of 0? Pin
Member 102679033-May-16 8:17
professionalMember 102679033-May-16 8:17 
GeneralRe: What is Sign of 0? Pin
Bassam Abdul-Baki2-May-16 5:09
professionalBassam Abdul-Baki2-May-16 5:09 
GeneralRe: What is Sign of 0? Pin
Kirk 103898213-May-16 7:20
Kirk 103898213-May-16 7:20 
GeneralRe: What is Sign of 0? Pin
OriginalGriff2-May-16 5:11
mveOriginalGriff2-May-16 5:11 
GeneralRe: What is Sign of 0? Pin
Marc Clifton2-May-16 5:33
mvaMarc Clifton2-May-16 5:33 
QuestionRe: What is Sign of 0? Pin
Matt T Heffron2-May-16 7:44
professionalMatt T Heffron2-May-16 7:44 
AnswerRe: What is Sign of 0? Pin
Chris @ SAS7-May-16 13:13
Chris @ SAS7-May-16 13:13 
GeneralRe: What is Sign of 0? Pin
Matt T Heffron7-May-16 20:26
professionalMatt T Heffron7-May-16 20:26 
GeneralRe: What is Sign of 0? Pin
Jochen Arndt2-May-16 5:17
professionalJochen Arndt2-May-16 5:17 
GeneralRe: What is Sign of 0? Pin
Marc Clifton2-May-16 5:34
mvaMarc Clifton2-May-16 5:34 
GeneralRe: What is Sign of 0? Pin
R. Giskard Reventlov2-May-16 5:27
R. Giskard Reventlov2-May-16 5:27 
GeneralRe: What is Sign of 0? Pin
90823652-May-16 5:35
90823652-May-16 5:35 
GeneralRe: What is Sign of 0? Pin
Sander Rossel2-May-16 5:50
professionalSander Rossel2-May-16 5:50 
GeneralRe: What is Sign of 0? Pin
Marc Clifton2-May-16 10:40
mvaMarc Clifton2-May-16 10:40 

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.