Re: Error in decimal divide in "?:" operator

Tech-Archive recommends: Fix windows errors by optimizing your registry



JayAchTee wrote:

I have a web service written in C# Visual Studio 2005 that calculates splits
between two or more timekeepers in a transaction. To set this up I have
several decimal data type variables from one particular timekeeper:

Using your code (roughly), I get:

~$ cat prog.cs
using System;

class App
{
static void Main()
{
decimal diff_time = 4.5M;
decimal rate = 130M;
decimal amount = diff_time * rate;
decimal totalAmount = 1605M;
decimal percent = (totalAmount == 0M ? 0M : amount /
totalAmount);
Console.WriteLine(percent);
}
}

~$ ./prog
0.364485981308411214953271028

Can you reproduce your behaviour in a simple, complete program like the
one above?

-- Barry

--
http://barrkel.blogspot.com/
.