Skip to main content
5 events
when toggle format what by license comment
Jan 15, 2021 at 1:31 comment added Filip Golewski For a reason you can't use Math.Truncate, you might want to go with Math.Floor and Math.Abs but for negative values you need to change sign like Math.Floor(Math.Abs(number)) * (number > 0 ? 1 : -1). Try dotnetfiddle example
Feb 27, 2020 at 15:11 comment added sschmidTU In C#, casting to int doesn't round, so (int)0.6f will be 0, and (int)343564565.5 will end in 5, not 6. Try here: repl.it/repls/LuxuriousCheerfulDistributeddatabase
Jan 26, 2009 at 22:44 comment added Keith Fair point - I guess that's why Math.Truncate(decimal) returns decimal.
Jan 26, 2009 at 14:12 comment added user1228 (long)Decimal.MaxValue overflows.
Jan 26, 2009 at 13:26 history answered Keith CC BY-SA 2.5