On 11 August 2013 18:27, Corneliu I. Tusnea <corne...@acorns.com.au> wrote:
> Yes, that's my issue. It seems that if you somehow tell is there are
> multiple zeros is keeps than and displays them during the .ToString().
> This is what I ended up doing:
<snip>
>         // we really really really want the value to be serialized as
> "0.0000" not "0.00" or "0.0000"!
>         //This is very important for all our hash calculations
> value = Math.Round(value, 4);
> value = Math.Round((((value+0.00001M)/10000)*10000)-0.00001M, 4); // divide
> first to force the appearance of 4 decimals
>         base.WriteValue(value);

You can simplify this to just:

value = Math.Round(0.0000M + value, 4);

-- 
Regards,
Mark Hurd, B.Sc.(Ma.)(Hons.)

Reply via email to