¡@

Home 

c# Programming Glossary: math.log10

Formatting numbers with significant figures in C#

http://stackoverflow.com/questions/158172/formatting-numbers-with-significant-figures-in-c-sharp

roundingPosition significantDigits 1 int Math.Floor Math.Log10 Math.Abs value try to use a rounding position directly if no.. decimals past 15 places var scale Math.Pow 10 Math.Ceiling Math.Log10 Math.Abs value return Math.Round value scale significantDigits..

Round a double to x significant figures

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

digits if d 0 return 0 double scale Math.Pow 10 Math.Floor Math.Log10 Math.Abs d 1 return scale Math.Round d scale digits If as in.. digits if d 0 return 0 double scale Math.Pow 10 Math.Floor Math.Log10 Math.Abs d 1 digits return scale Math.Truncate d scale share..

Calculate decibels

http://stackoverflow.com/questions/4152201/calculate-decibels

sample else if sample peak peak sample var decibel 20 Math.Log10 peak 32768 If I output the decibel value to the screen I can.. double rms Math.Sqrt sum _buffer.length 2 var decibel 20 Math.Log10 rms For 'instantaneous' dB levels you would normally calculate..

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

easiest way besides .ToString .Length is int Math.Truncate Math.Log10 x 1 However that performs rather poorly. Since my application.. return 8 if x 1000000000 return 9 return int Math.Truncate Math.Log10 x 1 Very uncommon This lets the length be computed with an average..

Engineering notation in C#?

http://stackoverflow.com/questions/808104/engineering-notation-in-c

string ToEngineeringNotation this double d double exponent Math.Log10 Math.Abs d if Math.Abs d 1 switch int Math.Floor exponent ..