Click here to Skip to main content
16,016,204 members
Home / Discussions / C#
   

C#

 
GeneralRe: Locate a treenode in a treeview Pin
DaveyM6918-Dec-07 11:49
professionalDaveyM6918-Dec-07 11:49 
GeneralHandwriting in windows server 2003 Pin
mehrdadc4818-Dec-07 7:24
mehrdadc4818-Dec-07 7:24 
GeneralLock the cursor type Pin
Kalvin @ Work18-Dec-07 5:55
Kalvin @ Work18-Dec-07 5:55 
GeneralRe: Lock the cursor type Pin
Skippums18-Dec-07 6:48
Skippums18-Dec-07 6:48 
GeneralRe: Lock the cursor type Pin
Kalvin @ Work18-Dec-07 7:50
Kalvin @ Work18-Dec-07 7:50 
GeneralRe: Lock the cursor type Pin
Skippums18-Dec-07 8:02
Skippums18-Dec-07 8:02 
GeneralRe: Lock the cursor type Pin
Kalvin @ Work18-Dec-07 11:10
Kalvin @ Work18-Dec-07 11:10 
QuestionMath.Round..What am I missing? Pin
jayart18-Dec-07 4:40
jayart18-Dec-07 4:40 
I need to programatically convert float values like 17.1054688 to 17.11 in C#
i.e want to restrict the float values upto 2 decimals.
For this I have written following code:

<br />
        private void Roundupto2Decimals(ref float fVal)<br />
        {   <br />
            string strVal = fVal.ToString("F2");<br />
            fVal = float.Parse(strVal);<br />
            double dVal = (double)fVal;<br />
        }<br />

In VS2005 watch window, I get the correct value for fVal.
for e.g:

Input : 17.1054688
strVal: "17.11"
fVal : 17.11
but ---> (double)fVal : 17.110000610351563
I am not sure when I typecast the same float to double I get unepcted value.
I expect dVal to be 17.11 too.
Can any one help me understand what is happening?
Thanks and Regards,
Arti Gujare
AnswerRe: Math.Round..What am I missing? Pin
Stevo Z18-Dec-07 4:47
Stevo Z18-Dec-07 4:47 
AnswerRe: Math.Round..What am I missing? Pin
benjymous18-Dec-07 4:58
benjymous18-Dec-07 4:58 
GeneralRe: Math.Round..What am I missing? Pin
jayart18-Dec-07 5:03
jayart18-Dec-07 5:03 
GeneralRe: Math.Round..What am I missing? Pin
Stevo Z18-Dec-07 5:27
Stevo Z18-Dec-07 5:27 
GeneralRe: Math.Round..What am I missing? Pin
jayart18-Dec-07 5:35
jayart18-Dec-07 5:35 
AnswerRe: Math.Round..What am I missing? Pin
led mike18-Dec-07 5:07
led mike18-Dec-07 5:07 
GeneralRe: Math.Round..What am I missing? Pin
jayart18-Dec-07 5:32
jayart18-Dec-07 5:32 
AnswerRe: Math.Round..What am I missing? Pin
dipak.dipak18-Dec-07 5:24
dipak.dipak18-Dec-07 5:24 
GeneralRe: Math.Round..What am I missing? Pin
Luc Pattyn18-Dec-07 5:55
sitebuilderLuc Pattyn18-Dec-07 5:55 
Questionquestion about FrameWork 3.5 Pin
E_Gold18-Dec-07 4:07
E_Gold18-Dec-07 4:07 
GeneralRe: question about FrameWork 3.5 Pin
Colin Angus Mackay18-Dec-07 4:31
Colin Angus Mackay18-Dec-07 4:31 
GeneralRe: question about FrameWork 3.5 Pin
Paul Conrad24-Dec-07 19:52
professionalPaul Conrad24-Dec-07 19:52 
QuestionHttpWebRequest ? Pin
cd_dvd18-Dec-07 3:59
cd_dvd18-Dec-07 3:59 
GeneralRe: HttpWebRequest ? Pin
Vasudevan Deepak Kumar18-Dec-07 4:12
Vasudevan Deepak Kumar18-Dec-07 4:12 
GeneralRe: HttpWebRequest ? Pin
cd_dvd18-Dec-07 4:31
cd_dvd18-Dec-07 4:31 
GeneralRuntime type casting Pin
Skippums18-Dec-07 3:23
Skippums18-Dec-07 3:23 
GeneralRe: Runtime type casting Pin
CKnig18-Dec-07 3:29
CKnig18-Dec-07 3:29 

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.