Re: Error in decimal divide in "?:" operator
- From: "Kevin Frey" <kevin_g_frey@xxxxxxxxxxx>
- Date: Thu, 8 Mar 2007 09:45:27 +1100
You mentioned evaluating some of the sub-expressions in the debugger? What
if you try evaluate the whole ternary (?:) expression in the debugger - do
you get the same result? Note: not sure if it can do this or not.
"JayAchTee" <JayAchTee@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:332A87F3-B507-450E-801D-8B87D8A8A40C@xxxxxxxxxxxxxxxx
I have not had any luck at duplicating the problem by simplifying the
application. The results are as expected. This one has me and my
colleagues
baffeled.
--
Regards,
JayAchTee
"Barry Kelly" wrote:
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/
.
- Follow-Ups:
- Re: Error in decimal divide in "?:" operator
- From: JayAchTee
- Re: Error in decimal divide in "?:" operator
- References:
- Re: Error in decimal divide in "?:" operator
- From: Barry Kelly
- Re: Error in decimal divide in "?:" operator
- Prev by Date: Re: Getting local admin groups and users on a windows server using ADSI
- Next by Date: Re: Array index
- Previous by thread: Re: Error in decimal divide in "?:" operator
- Next by thread: Re: Error in decimal divide in "?:" operator
- Index(es):