Click here to Skip to main content
15,912,329 members
Home / Discussions / C#
   

C#

 
GeneralRe: Web Serfer Monitor Pin
Dave Kreskowiak1-Mar-11 9:02
mveDave Kreskowiak1-Mar-11 9:02 
Questiondecimal.ToString() mystery [SOLVED] Pin
Super Lloyd28-Feb-11 11:20
Super Lloyd28-Feb-11 11:20 
AnswerRe: decimal.ToString() mystery Pin
Luc Pattyn28-Feb-11 11:38
sitebuilderLuc Pattyn28-Feb-11 11:38 
GeneralRe: decimal.ToString() mystery Pin
Super Lloyd28-Feb-11 11:47
Super Lloyd28-Feb-11 11:47 
AnswerRe: decimal.ToString() mystery Pin
Luc Pattyn28-Feb-11 12:01
sitebuilderLuc Pattyn28-Feb-11 12:01 
GeneralRe: decimal.ToString() mystery Pin
Super Lloyd28-Feb-11 12:09
Super Lloyd28-Feb-11 12:09 
GeneralRe: decimal.ToString() mystery Pin
Super Lloyd28-Feb-11 12:21
Super Lloyd28-Feb-11 12:21 
AnswerRe: decimal.ToString() mystery Pin
Luc Pattyn28-Feb-11 12:41
sitebuilderLuc Pattyn28-Feb-11 12:41 
So we both learned something today.

I tried a few things, and it seems the number of decimals can only increase.
When I multiply two numbers and show the result with ToString() I am getting (using decimal variables everywhere):

2 * 0.5 = 1.0
2.0 * 0.5 = 1.00

so multiplication adds the number of decimals of both multiplicands and propagates that to the product.

my conclusions would be:
1. there is a small difference between numbers, even when they have identical values (as in 1.0 and 1.00)
2. if you want to avoid all irrelevant trailing zeroes, you'd have to remove them explicitly.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: decimal.ToString() mystery Pin
V.28-Feb-11 20:35
professionalV.28-Feb-11 20:35 
AnswerRe: decimal.ToString() mystery Pin
Eddy Vluggen28-Feb-11 11:42
professionalEddy Vluggen28-Feb-11 11:42 
GeneralRe: decimal.ToString() mystery Pin
Super Lloyd28-Feb-11 11:50
Super Lloyd28-Feb-11 11:50 
GeneralRe: decimal.ToString() mystery Pin
Eddy Vluggen28-Feb-11 20:47
professionalEddy Vluggen28-Feb-11 20:47 
GeneralRe: decimal.ToString() mystery Pin
Super Lloyd28-Feb-11 21:11
Super Lloyd28-Feb-11 21:11 
GeneralRe: decimal.ToString() mystery Pin
Eddy Vluggen28-Feb-11 21:19
professionalEddy Vluggen28-Feb-11 21:19 
AnswerRe: decimal.ToString() mystery [SOLVED] Pin
RobCroll28-Feb-11 16:11
RobCroll28-Feb-11 16:11 
GeneralRe: decimal.ToString() mystery [SOLVED] Pin
Super Lloyd28-Feb-11 16:21
Super Lloyd28-Feb-11 16:21 
Questionmy program works very slow Pin
Erdinc2728-Feb-11 8:04
Erdinc2728-Feb-11 8:04 
AnswerRe: my program works very slow Pin
Luc Pattyn28-Feb-11 8:55
sitebuilderLuc Pattyn28-Feb-11 8:55 
AnswerRe: my program works very slow Pin
RobCroll28-Feb-11 12:16
RobCroll28-Feb-11 12:16 
AnswerRe: my program works very slow Pin
PIEBALDconsult28-Feb-11 13:19
mvePIEBALDconsult28-Feb-11 13:19 
GeneralRe: my program works very slow Pin
Erdinc273-Mar-11 5:09
Erdinc273-Mar-11 5:09 
Questionhow to programing Microsoft Management Console ?? Pin
GREG_DORIANcod28-Feb-11 4:58
professionalGREG_DORIANcod28-Feb-11 4:58 
AnswerRe: how to programing Microsoft Management Console ?? Pin
Eddy Vluggen28-Feb-11 6:02
professionalEddy Vluggen28-Feb-11 6:02 
AnswerRe: how to programing Microsoft Management Console ?? Pin
RaviRanjanKr28-Feb-11 17:09
professionalRaviRanjanKr28-Feb-11 17:09 
Questionaccessing folder from project Pin
jashimu28-Feb-11 4:37
jashimu28-Feb-11 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.