-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Type of issue
Code doesn't work
Description
//Code result = 0
decimal price = 0m;
decimal valUnits = 4295.000000m;
Console.WriteLine(Decimal.Multiply(price, valUnits));
//Code result = 0.000000
decimal price = 0m;
decimal valUnits = 4294.000000m;
Console.WriteLine(Decimal.Multiply(price, valUnits));
//Code result = 0.000000
decimal price = 0m;
decimal valUnits = 4295.00000m; //reduced decimal places to 5
Console.WriteLine(Decimal.Multiply(price, valUnits));
when working with decimal types, expectation is for result decimal to preserve the decimal zeros. Even if the result is 0, then it should be common for all the results.
Between 4294.000000 & 4295.000000, the binary values don't change significantly except for the lowest bit.
Page URL
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System/Decimal.xml
Document Version Independent Id
4ec1f71e-31ee-e91a-5126-48b16ef44812