Decimal Value is Zero when it should be 0.0x

Posted by Mike Wills on Stack Overflow See other posts from Stack Overflow or by Mike Wills
Published on 2010-03-15T19:47:47Z Indexed on 2010/03/15 19:49 UTC
Read the original article Hit count: 392

Filed under:
|
|

If this was previously talked about, I'm sorry, I had a hard time searching on this.

I am calculating a depreciation rate. One portion of our calculation is 1/life in months. My table stores this data in a decimal field. I tried test = 1 / estimatedLife; but the result of the calculation of test (which is defined as a decimal) is 0.

Say the estimated life is 36 months. So 1/36 should equal 0.02777778.

Any thoughts of what I am doing wrong?

BTW, I changed the test to a double and had the same result.

© Stack Overflow or respective owner

Related posts about c#

Related posts about decimal