473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

scientific notation

I have some values in type of double such 0.00009 , 0.0000007, when I want
to show them in a text box and convert them to string they are changed to
scientific notation while I want to show them as they are.
I tried to use tostring("f") but it needs to have a precision number after
*f* which will cause always have fix number of characters (for example if
use f10 then 0.09 is converted to 0.09000000 while I need to show it as
0.09).
do you any suggestion of how I can convert such a numbers to string and show
them as they are not as scientific notation?

Thanks for any feedback
Nov 21 '05 #1
2 4359
You may be able to use the "g" format specifier if you have a maximum number
of decimal places you could accept. For anything more complex (e.g.,
0.00009, but also 0.023), you'll need to write some code to choose between
various formatting strings depending on the value of your variable.

--George

"masoud bayan" <ma**********@hotmail.com> wrote in message
news:ec*************@TK2MSFTNGP09.phx.gbl...
I have some values in type of double such 0.00009 , 0.0000007, when I want
to show them in a text box and convert them to string they are changed to
scientific notation while I want to show them as they are.
I tried to use tostring("f") but it needs to have a precision number after *f* which will cause always have fix number of characters (for example if
use f10 then 0.09 is converted to 0.09000000 while I need to show it as
0.09).
do you any suggestion of how I can convert such a numbers to string and show them as they are not as scientific notation?

Thanks for any feedback

Nov 21 '05 #2
>I have some values in type of double such 0.00009 , 0.0000007, when I want
to show them in a text box and convert them to string they are changed to
scientific notation while I want to show them as they are.
I tried to use tostring("f") but it needs to have a precision number
after
*f* which will cause always have fix number of characters (for example if
use f10 then 0.09 is converted to 0.09000000 while I need to show it as
0.09).
do you any suggestion of how I can convert such a numbers to string and
show
them as they are not as scientific notation?


try ToString("0.########")...

--
Pozdrav,
Josip Medved, MCSD
http://www.jmedved.com

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Woodster | last post by:
I am using the std::setprecision function to format variables of type double in a string however I am unsure how to stop this appearing in scientific notation. For example std::stringstream...
1
by: masoud bayan | last post by:
I have some values in type of double such 0.00009 , 0.0000007, when I want to show them in a text box and convert them to string they are changed to scientific notation while I want to show them as...
1
by: Nick | last post by:
Well, the project I am working on has now come to a screeching halt! I have been developing a program that heavily utilizes ADO.NET record sets. To generate reports, I convert the recordset to XML,...
0
by: Greg | last post by:
I am working on an application that requires working with numbers in scientific notation. I am using SqlServer as the database and I have created strongly typed data adapters and datasets. The...
7
by: Dustan | last post by:
How can I get a number into scientific notation? I have a preference for the format '1 E 50' (as an example), but if it's well known, it works.
2
by: Ryan Liu | last post by:
In C#, for a large float (9 digitals), how can I disable Scientific notation. When it auto convert to Scientific notation, I lost accuracy. Thanks a lot! Ryan
9
by: Joe Attardi | last post by:
Hi all, Math is not my strongest area so forgive me if I use some of the wrong terminology. It seems that scientific notation is immune to rounding errors. For example: (4.98 * 100) + 5.51 ...
2
by: rSmoke | last post by:
I have a DataSet that contains a table with about 6 columns of high accuracy decimal values. When I try to write out the DataSet using the WriteXML() function the XML is written fine, but the...
7
by: grinder | last post by:
I have a program that fits a line to data points. The question is: can 'C' understand scientific notation (as below) , and if not what can i do to make it work.. 0.000 0.3231E+02 0.0000E+00 ...
2
by: Greg | last post by:
I am working on an application that requires working with numbers in scientific notation. I am using SqlServer as the database and I have created strongly typed data adapters and datasets. The...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.