Re: Variable type Money/Currency
- From: google.groups@xxxxxxxxxxxxxxxx
- Date: 9 Sep 2005 11:37:50 -0700
The help for CS0664 is pretty clear. By default, doubles cannot be
implicitly converted to decimal. 100.15 is considered a double. To
make it decimal write 100.15M:
deductionTotals += 100.15M;
http://www.peterRitchie.com/
tshad wrote:
> "Chris Dunaway" <dunawayc@xxxxxxxxx> wrote in message
> news:1126287869.237782.113620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > You'd probably be better off using a Decimal type
>
> But how do you add cents?
>
> I tried doing:
>
> deductionTotals += 100.15
>
> and got 2 errors:
>
> Literal of type double cannot be implicitly converted to type 'decimal';
> use an 'M' suffix to create a literal of this type
>
> and
>
> Operator '+=' cannot be applied to operands of type 'decimal' and
> 'double'
>
> Do I need to take all my calculations and multiply them by 100?
>
> Thanks,
>
> Tom
> >
.
- Follow-Ups:
- Re: Variable type Money/Currency
- From: tshad
- Re: Variable type Money/Currency
- References:
- Variable type Money/Currency
- From: tshad
- Re: Variable type Money/Currency
- From: Chris Dunaway
- Re: Variable type Money/Currency
- From: tshad
- Variable type Money/Currency
- Prev by Date: Session Problem..
- Next by Date: reading XML file?
- Previous by thread: Re: Variable type Money/Currency
- Next by thread: Re: Variable type Money/Currency
- Index(es):
Relevant Pages
|