Hello everyone,
Mentioned here,
http://msdn.microsoft.com/en-us/library/system.decimal(VS.80).aspx
What means "The scaling factor also preserves any trailing zeroes in a Decimal number"? Could anyone show me a sample please?
thanks in advance,
George
George GeorgePosted Jun 11, 2008, 3:52 AM
Sorry for any inconvenience, Ryan!
I will improve in the future. :-)
BTW: any comments to my original question?
regards,
George
Ryan AlfordPosted Jun 10, 2008, 1:14 PM
When you are reading articles from the MSDN(or wherever you read them from), do you really look for a grouping of words that you don't understand, and then come to a forum and ask what those specific words mean? I've seen you do it on multiple forums now(you actually post all of these same questions on multiple forums), and I am just wondering. You are given an answer that explains the entire paragraph, but then you pick out 4 words that you don't understand?
Jan MontanoPosted Jun 10, 2008, 1:04 AM
George GeorgePosted Jun 10, 2008, 12:49 AM
Thanks Jan!
How about this point of my question?
--------------------
Your samples pretty well demonstrate what means "preserves any trailing zeroes", but I am confused about what means "scaling factor also preserves" here?
BTW: I have the background of how Decimal and float are stored internally, but I do not know how could we utilize scale (I think it is the exponent) to preserve zero?
--------------------
regards,
George
Jan MontanoPosted Jun 9, 2008, 11:57 PM
double x = 45;
Console.WriteLine(x.ToString("#.0000")); // = 45.0000
x = 35.001;
Console.WriteLine(x.ToString("#.0000")); // = 35.0010
x = 39.12399;
Console.WriteLine(x.ToString("#.0000")); // = 39.1240
x = 39.12394;
Console.WriteLine(x.ToString("#.0000")); // = 39.1239
x = 39.9999;
Console.WriteLine(x.ToString("#.0000")); // = 39.9999
George GeorgePosted Jun 9, 2008, 10:16 PM
Thanks Mike!
1.
Your samples pretty well demonstrate what means "preserves any trailing zeroes", but I am confused about what means "scaling factor also preserves" here?
BTW: I have the background of how Decimal and float are stored internally, but I do not know how could we utilize scale (I think it is the exponent) to preserve zero?
2.
Could you show me how to use "#.0000" format please? I have tested "#.####" works, but how to use "#.0000"?
regards,
George
Mike GoldPosted Jun 9, 2008, 11:49 AM
I assume it means
1.960000 or 2.0000 where 0000 are the trailing 0's, but don't quote me. This becomes significant if you are using ToString "#.0000" format to display the floating point our double number.