Linked Questions
170 questions linked to/from Difference between decimal, float and double in .NET?
39
votes
1
answer
109k
views
What is the difference between "Double" and "double" in Java? [duplicate]
What is the difference between Double and double?
21
votes
2
answers
5k
views
float/double Math.Round in C# [duplicate]
float ff = (float)31.15;
double dd = 31.15;
var frst = Math.Round(ff, 1, MidpointRounding.AwayFromZero);
var drst = Math.Round(dd, 1, MidpointRounding.AwayFromZero);
frst: 31.1
drst: 31.2
Can ...
5
votes
4
answers
5k
views
Financial calculations: double or decimal? [duplicate]
We are working with financial calculations. I found this post about storing money values as decimals: decimal vs double! - Which one should I use and when?
So I'm storing amount as decimals.
I have ...
7
votes
3
answers
10k
views
What is the difference between 'decimal' and 'float' in C#? [duplicate]
What's the difference between using decimal or floatin C#? I know float is used for more precise decimal numbers and decimal is used for few decimals like currency or prices but when it's used for few ...
20
votes
0
answers
67k
views
Float, Double and Decimal Max Value vs Size [duplicate]
I have come across a confusing pattern of the size and Max value of these data types in C#.
While comparing these size using Marshal.SizeOf(), I have found following result-
Float- 4 bytes,
Double -...
6
votes
3
answers
4k
views
.NET C# float.Parse returning different result to double.Parse [duplicate]
Can some more experienced guys explain this strange error I found today?
I was getting strange amounts when I was loading table data with my C# script.
As it turns out the problem is a different ...
3
votes
2
answers
657
views
Why same values differ with float and double [duplicate]
Consider this program
float a = 0.7f;
if (a < 0.7)
{
Console.WriteLine("Less");
}
The output is Less. Why??
2
votes
3
answers
1k
views
C# issue with double number [duplicate]
I have a strange issue using double numbers in C# . NET here is my test:
double my_value = 0.49;
the problem is that the variable value shown is instead 0.48999999999999999 I do not need to display 0....
2
votes
2
answers
4k
views
What is Double? (C#) [duplicate]
Possible Duplicate:
What is the difference between Decimal, Float and Double in C#?
Today I'm wondering about Double in .Net. I've used it with Int32 the past days and started wondering what the ...
1
vote
2
answers
2k
views
Why does my double round my variables sometimes? [duplicate]
I really dont unterstand why, but my double array just sometimes round my variables, even though it shouldn't. The weird thing is, that it only does this sometimes, as you see in the picture. All of ...
3
votes
3
answers
1k
views
Convert Double --> Decimal not exactly [duplicate]
Possible Duplicate:
What is the difference between Decimal, Float and Double in C#?
Help me.
I am developing a application in C# . I am trying:
DateTime dtm1 = new DateTime(2012, 11, 15, 11, 3, ...
2
votes
1
answer
187
views
Why is this output when compare a float and a double [duplicate]
I wrote a program in c#
static void Main(string[] args)
{
float c = 1....
0
votes
1
answer
218
views
Calculation result is different depending on decimal or double [duplicate]
Can someone please explain why the calculated value 180 * 2.2 will be different when stored in a decimal vs. a double; and perhaps also explain why .NET is calculating 180 * 2.2 with a decimal point ...
0
votes
1
answer
267
views
Why most of the .NET libraries use Double instead of Decimal? And which one should I use? [duplicate]
I noticed that many libraries (for example, Math.net, NodaTime, TALib .NET port (library for technical analysis), StackExchange client for Redis db) use Double instead of Decimal. Why is that?
I know ...
-2
votes
1
answer
116
views
Incorrect value while performing an arithmetic subtraction on two elements of a list [duplicate]
I am performing arithmetic subtraction on the elements of a C# list of type double and it results in some incorrect results sometimes
For example I have three elements in the listTempStrike as ...