I've had a similar issue. A rather agly fix is to convert to string and back
as shown below, or use Decimal.Round() or Decimal.Truncate().

string str;
if (data == decimal.Zero)
        str = decimal.Zero.ToString();
else {
        str = data.ToString();
        bool hasDecimalPoint = false;
        foreach (char c in str)
                if (c == '.') {
                        hasDecimalPoint = true;
                        break;
                }

        // remove trailing zeros
        if (hasDecimalPoint) {
                int truncIx = str.Length - 1;
                while (truncIx > 1 && str[truncIx] == '0')
                        --truncIx;
                if (str[truncIx] == '.')
                        --truncIx;
                if (truncIx < str.Length - 1)
                        str = str.Substring(0, truncIx + 1);
        }
}

--
View this message in context: 
http://mono.1490590.n4.nabble.com/Bug-in-the-scale-of-the-result-of-decimal-division-tp4375794p4375815.html
Sent from the Mono - General mailing list archive at Nabble.com.
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to