0.00007m -> 7E-5 ?  
Author Message
Bruincdc





PostPosted: Tue Dec 14 02:09:17 CST 2004 Top

Visual C#.Net >> 0.00007m -> 7E-5 ? Hello.
I'd want to see the right value that inserted, but very small value like
0.00007m doesn't displayed exactly(displayed 7E-5).

ex)
decimal b = 0.00007m;

TextBox.Text = b.ToString(); => 7E-5
TextBox.Text = b.ToString("F"); => 0.00
TextBox.Text = b.ToString("0.00000"); => 0.00007 (but 0.00000007 not
supported)
TextBox.Text = b.ToString("0.0000000000"); => 0.0000700000

so, I want to know the string format type that all decimal values show the
values as it is.

decimal b = 0.00007m; ( for all decimal cases like 0.0000007m,
0.0000000000007m )
TextBox.Text = b.ToString(????); => 0.00007

Please, help me~ ^^

ps. maybe understanding this question is harder than solving..^^ sorry and
thanks..

DotNet356  
 
 
Lowell





PostPosted: Tue Dec 14 02:09:17 CST 2004 Top

Visual C#.Net >> 0.00007m -> 7E-5 ? Where are you putting the data to be shown at ? I compiled this code and
it showed up exactly perfect, the way it should:

decimal d = 0.00007m;
string test = d.ToString();
MessageBox.Show(test);

I got a response of a messagebox showing 0.00007

The problem could be perhaps that whatever you are showing the data in
cannot support a number that big(or small)?

Lowell



antonio. kim wrote:
> Hello.
> I'd want to see the right value that inserted, but very small value like
> 0.00007m doesn't displayed exactly(displayed 7E-5).
>
> ex)
> decimal b = 0.00007m;
>
> TextBox.Text = b.ToString(); => 7E-5
> TextBox.Text = b.ToString("F"); => 0.00
> TextBox.Text = b.ToString("0.00000"); => 0.00007 (but 0.00000007 not
> supported)
> TextBox.Text = b.ToString("0.0000000000"); => 0.0000700000
>
> so, I want to know the string format type that all decimal values show the
> values as it is.
>
> decimal b = 0.00007m; ( for all decimal cases like 0.0000007m,
> 0.0000000000007m )
> TextBox.Text = b.ToString(????); => 0.00007
>
> Please, help me~ ^^
>
> ps. maybe understanding this question is harder than solving..^^ sorry and
> thanks..
 
 
Antoniokim





PostPosted: Tue Dec 14 02:27:02 CST 2004 Top

Visual C#.Net >> 0.00007m -> 7E-5 ? Thank you for answering..
but I use the same code that you suggest, I got 7E-5...
maybe other configulation is different between our machines..
is there anybody knows this?

"Lowell Heddings" wrote:

> Where are you putting the data to be shown at ? I compiled this code and
> it showed up exactly perfect, the way it should:
>
> decimal d = 0.00007m;
> string test = d.ToString();
> MessageBox.Show(test);
>
> I got a response of a messagebox showing 0.00007
>
> The problem could be perhaps that whatever you are showing the data in
> cannot support a number that big(or small)?
>
> Lowell
>
>
>
> antonio. kim wrote:
> > Hello.
> > I'd want to see the right value that inserted, but very small value like
> > 0.00007m doesn't displayed exactly(displayed 7E-5).
> >
> > ex)
> > decimal b = 0.00007m;
> >
> > TextBox.Text = b.ToString(); => 7E-5
> > TextBox.Text = b.ToString("F"); => 0.00
> > TextBox.Text = b.ToString("0.00000"); => 0.00007 (but 0.00000007 not
> > supported)
> > TextBox.Text = b.ToString("0.0000000000"); => 0.0000700000
> >
> > so, I want to know the string format type that all decimal values show the
> > values as it is.
> >
> > decimal b = 0.00007m; ( for all decimal cases like 0.0000007m,
> > 0.0000000000007m )
> > TextBox.Text = b.ToString(????); => 0.00007
> >
> > Please, help me~ ^^
> >
> > ps. maybe understanding this question is harder than solving..^^ sorry and
> > thanks..
>
 
 
Morten





PostPosted: Tue Dec 14 04:03:45 CST 2004 Top

Visual C#.Net >> 0.00007m -> 7E-5 ? Odd,

As far as I know the only configuration differences are in currency
formats and the use of , or . as decimal point.

Regular output for me is always 0,00007 (, is the decimal point) and
scientific format ("E") is output as 7,000000E-005 not 7E-5.

You might try the General specifier ("G") which outputs the number in the
shortest of fixed or scientific. This always gave me 0,00007.

Btw, "0.0000" == "F5", easier to write :)

On Tue, 14 Dec 2004 00:27:02 -0800, Antonio. kim
<EMail@HideDomain.com> wrote:

> Thank you for answering..
> but I use the same code that you suggest, I got 7E-5...
> maybe other configulation is different between our machines..
> is there anybody knows this?
>
> "Lowell Heddings" wrote:
>
>> Where are you putting the data to be shown at ? I compiled this code and
>> it showed up exactly perfect, the way it should:
>>
>> decimal d = 0.00007m;
>> string test = d.ToString();
>> MessageBox.Show(test);
>>
>> I got a response of a messagebox showing 0.00007
>>
>> The problem could be perhaps that whatever you are showing the data in
>> cannot support a number that big(or small)?
>>
>> Lowell
>>
>>
>>
>> antonio. kim wrote:
>> > Hello.
>> > I'd want to see the right value that inserted, but very small value
>> like
>> > 0.00007m doesn't displayed exactly(displayed 7E-5).
>> >
>> > ex)
>> > decimal b = 0.00007m;
>> >
>> > TextBox.Text = b.ToString(); => 7E-5
>> > TextBox.Text = b.ToString("F"); => 0.00
>> > TextBox.Text = b.ToString("0.00000"); => 0.00007 (but 0.00000007 not
>> > supported)
>> > TextBox.Text = b.ToString("0.0000000000"); => 0.0000700000
>> >
>> > so, I want to know the string format type that all decimal values
>> show the
>> > values as it is.
>> >
>> > decimal b = 0.00007m; ( for all decimal cases like 0.0000007m,
>> > 0.0000000000007m )
>> > TextBox.Text = b.ToString(????); => 0.00007
>> >
>> > Please, help me~ ^^
>> >
>> > ps. maybe understanding this question is harder than solving..^^
>> sorry and
>> > thanks..
>>



--
Happy Coding!
Morten Wennevik [C# MVP]
 
 
Stefan





PostPosted: Fri Dec 17 04:06:41 CST 2004 Top

Visual C#.Net >> 0.00007m -> 7E-5 ? Doubles seem to use the scientific format you mentioned. Are you sure you're
using decimal?

For me, it's:

0.00007.ToString() => 7E-5
0.00007m.ToString() => 0,00007

even

0.0000000000000000000000000007m.ToString()
yields
0,0000000000000000000000000007

HTH,
Stefan

"Morten Wennevik" <EMail@HideDomain.com> wrote in message
news:opsizswjb8klbvpo@pbn_computer...
> Odd,
>
> As far as I know the only configuration differences are in currency
> formats and the use of , or . as decimal point.
>
> Regular output for me is always 0,00007 (, is the decimal point) and
> scientific format ("E") is output as 7,000000E-005 not 7E-5.
>
> You might try the General specifier ("G") which outputs the number in the
> shortest of fixed or scientific. This always gave me 0,00007.
>
> Btw, "0.0000" == "F5", easier to write :)
>
> On Tue, 14 Dec 2004 00:27:02 -0800, Antonio. kim
> <EMail@HideDomain.com> wrote:
>
>> Thank you for answering..
>> but I use the same code that you suggest, I got 7E-5...
>> maybe other configulation is different between our machines..
>> is there anybody knows this?
>>
>> "Lowell Heddings" wrote:
>>
>>> Where are you putting the data to be shown at ? I compiled this code and
>>> it showed up exactly perfect, the way it should:
>>>
>>> decimal d = 0.00007m;
>>> string test = d.ToString();
>>> MessageBox.Show(test);
>>>
>>> I got a response of a messagebox showing 0.00007
>>>
>>> The problem could be perhaps that whatever you are showing the data in
>>> cannot support a number that big(or small)?
>>>
>>> Lowell
>>>
>>>
>>>
>>> antonio. kim wrote:
>>> > Hello.
>>> > I'd want to see the right value that inserted, but very small value
>>> like
>>> > 0.00007m doesn't displayed exactly(displayed 7E-5).
>>> >
>>> > ex)
>>> > decimal b = 0.00007m;
>>> > TextBox.Text = b.ToString(); => 7E-5
>>> > TextBox.Text = b.ToString("F"); => 0.00
>>> > TextBox.Text = b.ToString("0.00000"); => 0.00007 (but 0.00000007 not
>>> > supported)
>>> > TextBox.Text = b.ToString("0.0000000000"); => 0.0000700000
>>> >
>>> > so, I want to know the string format type that all decimal values
>>> show the
>>> > values as it is.
>>> >
>>> > decimal b = 0.00007m; ( for all decimal cases like 0.0000007m,
>>> > 0.0000000000007m )
>>> > TextBox.Text = b.ToString(????); => 0.00007
>>> >
>>> > Please, help me~ ^^
>>> >
>>> > ps. maybe understanding this question is harder than solving..^^
>>> sorry and
>>> > thanks..
>>>
>
>
>
> --
> Happy Coding!
> Morten Wennevik [C# MVP]