DecimalPrecision Wiki Rss Feedhttps://decimalprecision.codeplex.com/DecimalPrecision Wiki Rss DescriptionUpdated Wiki: Homehttp://decimalprecision.codeplex.com/wikipage?version=4<div class="wikidoc"><b>Project Description</b><br />Extension for Decimal data type helps to set a specific precision for decimal number also setting number of decimal places and adding insignificant zeroes<br /><b>DecimalPrecision</b> adds extension methods to work with the decimal data type.<br />Decimal are extremely useful when the size of number handled are relatively small and the decimal digits are very important and must not change.<br />Typical scenario are scientific measurement in validated environments or monetary operations, where the implicit rounding introduced by the floating points type are not acceptable.<br /><br />In these contests is often important to know the precision of the measured value, or in other words, the number of decimal places after the decimal separator.<br /><br />Usually data types like float or double cannot handle insignificant zeroes in number like 3.140<br />But these zeroes are not always insignificant. In certain context it is important to know the precision of the machinery that have produced the value and the fact that that third decimal digit was effectively read as Zero, because this means that the original value is at worst 3.14049999...<br />Otherwise, considering 3.14 we could also suppose that the original value can also be 3.1449999.. that makes a great difference in certain scenarios.<br /><br />So, insignificant zeroes matters.<br /><br />System.Decimal can handle this situation but lacks of functions that helps with this job.<br /><br />Usually developer does this <u>wrong</u> by manipulating strings and then parsing these again.<br />This is a bad practice because strings representations depends on system culture and can lead to disastrous results if precautions are not taken. Plus, it is very ugly and unstylish to manipulate strings... and sounds like a practice of the previous century.<br /><br /><b>DecimalPrecision</b> works directly on the bits that makes the representation of the decimal type. <br />System.Decimal can by itself represent insignificant zeroes, but usually these are removed during the calculation and no functions are available in the framework to programmatically work on the precision of the number.<br /><br />The library is very light, it has no external dependencies other than frameworks assembly. it is compiled for the 4.0 but works also on the 3.5 or the 4.5<br /><br />the main function is <i>SetPrecision</i> that is exposed as an extension method of the decimal type.<br /><br />you can for example write<br /><br /><i>(123.4m).SetPrecision(3); // this create a decimal that is 123.400</i><br /><br />other functions helps more with rounding instead of truncation.<br /><br />Tests are available for a quick reference.</div><div class="ClearBoth"></div>Duke360Tue, 22 Jan 2013 09:16:22 GMTUpdated Wiki: Home 20130122091622AUpdated Wiki: Homehttp://decimalprecision.codeplex.com/wikipage?version=3<div class="wikidoc"><b>Project Description</b><br />Extension for Decimal data type helps to set a specific precision for decimal number also setting number of decimal places and adding insignificant zeroes<br /><b>DecimalPrecision</b> adds extension methods to work with the decimal data type.<br />Decimal are extremely useful when the size of number handled are relatively small and the decimal digits are very important and must not change.<br />Typical scenario are scientific measurement in validated environments or monetary operations, where the implicit rounding introduced by the floating points type are not acceptable.<br /><br />In these contests is often important to know the precision of the measured value, or in other words, the number of decimal places after the decimal separator.<br /><br />Usually data types like float or double cannot handle insignificant zeroes in number like 3.140<br />But these zeroes are not always insignificant. In certain context it is important to know the precision of the machinery that have produced the value and the fact that that third decimal digit was effectively read as Zero, because this means that the original value is at worst 3.14049999...<br />Otherwise, considering 3.14 we could also suppose that the original value can also be 3.1449999.. that makes a great difference in certain scenarios.<br /><br />So, insignificant zeroes matters.<br /><br />System.Decimal can handle this situation but lacks of functions that helps with this job.<br /><br />Usually developer does this <u>wrong</u> by manipulating strings and then parsing these again.<br />This is a bad practice because strings representations depends on system culture and can lead to disastrous results if precautions are not taken. Plus, it is very ugly and unstylish to manipulate strings... and sounds like a practice of the previous century.<br /><br /><b>DecimalPrecision</b> works directly on the bits that makes the representation of the decimal type. <br />System.Decimal can by itself represent insignificant zeroes, but usually these are removed during the calculation and no functions are available in the framework to programmatically work on the precision of the number.<br /><br />The library is very light, it has no external dependencies other than frameworks assembly. it is compiled for the 4.0 but works also on the 3.5<br /><br />the main function is <i>SetPrecision</i> that is exposed as an extension method of the decimal type.<br /><br />you can for example write<br /><br /><i>(123.4m).SetPrecision(3); // this create a decimal that is 123.400</i><br /><br />other functions helps more with rounding instead of truncation.<br /><br />Tests are available for a quick reference.</div><div class="ClearBoth"></div>Duke360Tue, 22 Jan 2013 09:15:45 GMTUpdated Wiki: Home 20130122091545A