Click here to Skip to main content
15,915,611 members
Home / Discussions / C#
   

C#

 
QuestionHow do i clear a list box Pin
Wamuti4-Sep-08 4:20
Wamuti4-Sep-08 4:20 
AnswerRe: How do i clear a list box [modified] Pin
John Ad4-Sep-08 4:26
John Ad4-Sep-08 4:26 
GeneralRe: How do i clear a list box Pin
Wamuti4-Sep-08 4:31
Wamuti4-Sep-08 4:31 
QuestionWhat is the difference - Convert.Int32() --- Int32.Parse() --- (int) Pin
dataminers4-Sep-08 3:53
dataminers4-Sep-08 3:53 
AnswerRe: What is the difference - Convert.Int32() --- Int32.Parse() --- (int) Pin
Ravi Bhavnani4-Sep-08 3:56
professionalRavi Bhavnani4-Sep-08 3:56 
AnswerRe: What is the difference - Convert.Int32() --- Int32.Parse() --- (int) Pin
DaveyM694-Sep-08 4:09
professionalDaveyM694-Sep-08 4:09 
AnswerRe: What is the difference - Convert.Int32() --- Int32.Parse() --- (int) Pin
Guffa4-Sep-08 6:53
Guffa4-Sep-08 6:53 
QuestionPause and Resume facility in a downloader application using C# Pin
Student Developer4-Sep-08 3:32
Student Developer4-Sep-08 3:32 
AnswerRe: Pause and Resume facility in a downloader application using C# Pin
Ravi Bhavnani4-Sep-08 3:54
professionalRavi Bhavnani4-Sep-08 3:54 
QuestionSecure Data Exchange Between WinfForm app and Web Service Pin
#realJSOP4-Sep-08 3:22
professional#realJSOP4-Sep-08 3:22 
AnswerRe: Secure Data Exchange Between WinfForm app and Web Service Pin
Manas Bhardwaj4-Sep-08 3:27
professionalManas Bhardwaj4-Sep-08 3:27 
AnswerRe: Secure Data Exchange Between WinfForm app and Web Service Pin
Ravi Bhavnani4-Sep-08 4:02
professionalRavi Bhavnani4-Sep-08 4:02 
GeneralRe: Secure Data Exchange Between WinfForm app and Web Service Pin
#realJSOP4-Sep-08 4:11
professional#realJSOP4-Sep-08 4:11 
AnswerRe: Secure Data Exchange Between WinfForm app and Web Service Pin
led mike4-Sep-08 5:29
led mike4-Sep-08 5:29 
AnswerRe: Secure Data Exchange Between WinfForm app and Web Service Pin
leppie4-Sep-08 9:05
leppie4-Sep-08 9:05 
GeneralRe: Secure Data Exchange Between WinfForm app and Web Service Pin
#realJSOP5-Sep-08 0:20
professional#realJSOP5-Sep-08 0:20 
GeneralRe: Secure Data Exchange Between WinfForm app and Web Service Pin
leppie5-Sep-08 3:50
leppie5-Sep-08 3:50 
Questiondouble Pin
RugbyLeague4-Sep-08 2:20
RugbyLeague4-Sep-08 2:20 
AnswerRe: double [modified] Pin
c24234-Sep-08 2:51
c24234-Sep-08 2:51 
AnswerRe: double Pin
RugbyLeague4-Sep-08 2:52
RugbyLeague4-Sep-08 2:52 
AnswerRe: double Pin
Mbah Dhaim4-Sep-08 2:53
Mbah Dhaim4-Sep-08 2:53 
AnswerRe: double Pin
DaveyM694-Sep-08 3:11
professionalDaveyM694-Sep-08 3:11 
GeneralRe: double [modified] Pin
#realJSOP4-Sep-08 3:27
professional#realJSOP4-Sep-08 3:27 
First, you don't need the "d" notation after the numbers (and you could initialize d like so: double d = 0.0;.

Next, floating point math is not precise. Since a CPU is inherently an integer processor, performing floating point math results in an approximation.

Try using decimal for the math, and then cast it to a double.

decimal d = 0.0m;
d += 0.0963m;
d += 0.0029m;
d += 0.0654m;
d += 0.0386m;
d += 0.0526m;
    double d2 = Convert.ToDouble(d);



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


modified on Thursday, September 4, 2008 9:34 AM

GeneralRe: double Pin
Dan Neely4-Sep-08 4:32
Dan Neely4-Sep-08 4:32 
QuestionPanel screencapture is black in invisible part of panel Pin
joost.versteegen4-Sep-08 2:05
joost.versteegen4-Sep-08 2:05 

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.