473,499 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Number of digits in exponent with "g" format?

Hello,

By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.

Thanks,
Ray
Jul 17 '08 #1
3 4305
Ray Mitchell wrote:
By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.
Something like x.ToString("e") or x.ToString("0.00000000e+000") will
always use scientific format with 3 digits in the exponent.

Arne
Jul 18 '08 #2


"Arne Vajhøj" wrote:
Ray Mitchell wrote:
By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.

Something like x.ToString("e") or x.ToString("0.00000000e+000") will
always use scientific format with 3 digits in the exponent.

Arne
Yes, but I don't always want scientific. I want it to be done like "g" does
it except that when it does "choose" scientific, it uses 3 digits of exponent
instead of 2.
Jul 18 '08 #3
Ray Mitchell wrote:
"Arne Vajhøj" wrote:
>Ray Mitchell wrote:
>>By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.
Something like x.ToString("e") or x.ToString("0.00000000e+000") will
always use scientific format with 3 digits in the exponent.

Yes, but I don't always want scientific. I want it to be done like "g" does
it except that when it does "choose" scientific, it uses 3 digits of exponent
instead of 2.
Unfortunately there does not seem to be support for that in
..NET (NumberFormatInfo).

You will have to find the borders and write some code
that tests for inside/outside and call code accordingly.

Arne
Jul 19 '08 #4

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

Similar topics

0
2919
by: martin.mrazek | last post by:
Hello, I wanted to install Number::Format module bud ended up with following error message. Does anybody have any suggestion what the cause could be?? Could that be due to presence of perldl in my...
3
2411
by: John H. | last post by:
Hi, Why if set a DataTable in Crystal Report Net Table with method SetDataSource, 'ReportDocument.SetDataSource(oDataTable)', lost the Number and Currency format with the decimal digits and...
1
8800
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
1086
by: moondog | last post by:
I would like my project to have its version numbers in the 1.2.3.4 format; however, whenever I change the "version" property in my setup deployment project I get this error...
0
1827
by: richasaraf | last post by:
Hi all, Please help me out... i want to convert the to_char into number format.... please let em know how to do it... for eg: i have a statement : to_char(p_number, 'S000000') this...
1
1249
by: ADA | last post by:
Hi all, I have a funny problem. I have a function in Windows Application, which builds dataset in run time, adds data into the dataset and returns XML. One of dataset columns has System.Double...
0
2486
by: Wayne | last post by:
I am charting data from a query that consists of a Date/Time field and a Number field. The Date/Time field is the x scale on my chart. Sometimes data is collected from different times during the...
10
13688
by: Dixie | last post by:
I am appending some new fields to a table in vba and when I append a number field with is a byte, it does not inherit any format. I want it to be the General Number format, but it is blank. I...
6
2909
by: psbasha | last post by:
I have a input format XX:YY:ZZ and the start value may be 'n' digit numbers for X,Y,Z. So I have to assign the numbers based on the above format ( Format may change) Say Example - 1 ...
1
4573
by: michaelw118 | last post by:
Hi, I hope someone can give me some solutions to these problems I faced. I imported some data to Excel. Then in Access, I table-linked to this file. I have two fields which in Excel is in...
0
7012
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.