From: Valli on 24 Mar 2010 09:55 Hi, I have an issue of displaying a double variable in .net. I receive a double data through socket from C project into .net. The value entering is 2010030550004850. But it gets stored as 2.01003055000485E+15. I need the original value. How can I do this? Can anyone help me out -- Thanks & regards, V.Valli This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and may be unlawful.
From: PvdG42 on 24 Mar 2010 10:14 "Valli" <valli(a)chellsoft.com> wrote in message news:esvTvm1yKHA.4492(a)TK2MSFTNGP05.phx.gbl... > Hi, > > I have an issue of displaying a double variable in .net. > > I receive a double data through socket from C project into .net. The > value entering is 2010030550004850. > But it gets stored as 2.01003055000485E+15. I need the original value. > How can I do this? Can anyone help me out > > -- > Thanks & regards, > > V.Valli > The value was stored in "E-notation" in the C program as well, and the value is the same. Typically, you would display the value as a string, using whatever formatting you deem appropriate. How are you attempting to display the value? The .NET Double structure includes a ToString() method designed to help you. http://msdn.microsoft.com/en-us/library/system.double_members.aspx
From: Patrice on 24 Mar 2010 10:30 They are the same value. It seems you are confusing how the variable is really stored in memory and its text representation (the default is "G"eneral which is the shortest between fixed point and scientific notation) .. For example here if I display a variable to which I assigned 1.2, I'll see 1,2. But the underlying value is stored the same than on every other computer on earth. It is just that the text representation for my country uses a comma rather than a dot. You can control the format used to display the value using http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx but knowing more about the context could help (for example if you display this in a form, you have form mechanism for formatting). Try the "f" format or perhaps a custom format depending on how you want to handle decimal places... -- Patrice "Valli" <valli(a)chellsoft.com> a �crit dans le message de groupe de discussion : esvTvm1yKHA.4492(a)TK2MSFTNGP05.phx.gbl... > Hi, > > I have an issue of displaying a double variable in .net. > > I receive a double data through socket from C project into .net. The > value entering is 2010030550004850. > But it gets stored as 2.01003055000485E+15. I need the original value. > How can I do this? Can anyone help me out > > -- > Thanks & regards, > > V.Valli > > > This e-mail and any files transmitted with it are for the sole use of the > intended recipient(s) and may contain confidential and privileged > information. If you are not the intended recipient, please contact the > sender by reply e-mail and destroy all copies of the original message. > > Any unauthorized review, use, disclosure, dissemination, forwarding, > printing or copying of this email is strictly prohibited and may be > unlawful. > >
From: Valli on 24 Mar 2010 11:23 I need to update this value in database in numeric datatype. The .tostring() methods also returns the value in exponent form only. -- Thanks & regards, V.Valli This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and may be unlawful. "PvdG42" <pvdg42(a)toadstool.edu> wrote in message news:%2363MZx1yKHA.5936(a)TK2MSFTNGP04.phx.gbl... > > "Valli" <valli(a)chellsoft.com> wrote in message > news:esvTvm1yKHA.4492(a)TK2MSFTNGP05.phx.gbl... >> Hi, >> >> I have an issue of displaying a double variable in .net. >> >> I receive a double data through socket from C project into .net. The >> value entering is 2010030550004850. >> But it gets stored as 2.01003055000485E+15. I need the original value. >> How can I do this? Can anyone help me out >> >> -- >> Thanks & regards, >> >> V.Valli >> > The value was stored in "E-notation" in the C program as well, and the > value is the same. Typically, you would display the value as a string, > using whatever formatting you deem appropriate. How are you attempting to > display the value? > The .NET Double structure includes a ToString() method designed to help > you. > > http://msdn.microsoft.com/en-us/library/system.double_members.aspx > >
From: Family Tree Mike on 24 Mar 2010 12:28 "Valli" wrote: > I need to update this value in database in numeric datatype. > The .tostring() methods also returns the value in exponent form only. > > -- > Thanks & regards, > > V.Valli > > That's true, but if you use the overload value.ToString("f0"), you get the value without the exponentiation. The zero can be replaced with the number of decimal places desired. Mike
|
Next
|
Last
Pages: 1 2 Prev: Can be done? Next: Configure Properties of Windows User (Terminal Server Eviroment) |