¡@

Home 

c# Programming Glossary: math.truncate

C# Double - ToString() formatting with two decimal places but no rounding

http://stackoverflow.com/questions/2453951/c-sharp-double-tostring-formatting-with-two-decimal-places-but-no-rounding

share improve this question I use the following double x Math.Truncate myDoubleValue 100 100 For instance If the number is 50.947563.. and you use the following the following will happen Math.Truncate 50.947563 100 100 Math.Truncate 5094.7563 100 5094 100 50.94.. the following will happen Math.Truncate 50.947563 100 100 Math.Truncate 5094.7563 100 5094 100 50.94 And there's your answer truncated..

Truncate Two decimal places without rounding

http://stackoverflow.com/questions/3143657/truncate-two-decimal-places-without-rounding

2 c# math rounding share improve this question value Math.Truncate 100 value 100 Beware that fractions like these cannot be accurately..

Format TimeSpan greater than 24 hour

http://stackoverflow.com/questions/3505230/format-timespan-greater-than-24-hour

As String Return String.Format 0 hr 1 mn 2 sec _ CInt Math.Truncate span.TotalHours _ span.Minutes _ span.Seconds End Function..

Round a double to x significant figures

http://stackoverflow.com/questions/374316/round-a-double-to-x-significant-figures

Limiting double to 3 decimal places

http://stackoverflow.com/questions/3814190/limiting-double-to-3-decimal-places

the way that rounding happens that's a problem you can use Math.Truncate value 1000 1000 which may do what you want. You don't want rounding.. decimal value however it would work decimal m 12.878999m m Math.Truncate m 1000m 1000m Console.WriteLine m 12.878 EDIT As LBushkin pointed..

Fastest way to calculate the decimal length of an integer? (.NET)

http://stackoverflow.com/questions/679602/fastest-way-to-calculate-the-decimal-length-of-an-integer-net

function. The easiest way besides .ToString .Length is int Math.Truncate Math.Log10 x 1 However that performs rather poorly. Since my.. x 100000000 return 8 if x 1000000000 return 9 return int Math.Truncate Math.Log10 x 1 Very uncommon This lets the length be computed.. of only 3 compares. As per Sean's comment I removed the Math.Truncate. Together this boosted things about 10 . Thanks c# .net performance..

How do I Async download multiple files using webclient, but one at a time?

http://stackoverflow.com/questions/6992553/how-do-i-async-download-multiple-files-using-webclient-but-one-at-a-time

bytesIn totalBytes 100 progressBar1.Value int.Parse Math.Truncate percentage .ToString c# asynchronous webclient share improve..