Re: how to make a decimal a power of ten?
From: cody (deutronium_at_gmx.de)
Date: 01/18/05
- Next message: Mezzmaster: "Terminal Server CAL's in Windows 2003 Enterprise Server"
- Previous message: Nick Malik [Microsoft]: "Re: Vb.net Telnet VT100"
- In reply to: Niki Estner: "Re: how to make a decimal a power of ten?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 18 Jan 2005 17:06:43 +0100
Yes that will do it!
"Niki Estner" <niki.estner@cube.net> schrieb im Newsbeitrag
news:ePZbY2W$EHA.4004@tk2msftngp13.phx.gbl...
> "cody" <deutronium@gmx.de> wrote in
> news:OwPQctW$EHA.3596@TK2MSFTNGP12.phx.gbl...
> >I want to do some validation of data field something like the following:
> >
> >
System.Diagnostics.Debug.Assert(decimal.Truncate(this.GesamtPreis*100)==this
> > .GesamtPreis*100);
> >
> > so that Iam sure that no more than a certain number of decimals are
> > stored,
> > but I don't want to hardcode them I want that the user can set how many
> > decimals are stored?
> >
> > I cannot use Math.Pow() since it works with double instead of decimal so
I
> > have rounding errors.
>
> Why don't you use "decimal.Round(x, NumberOfDigits) == x"? Wouldn't that
do
> what you want?
>
> Niki
>
>
- Next message: Mezzmaster: "Terminal Server CAL's in Windows 2003 Enterprise Server"
- Previous message: Nick Malik [Microsoft]: "Re: Vb.net Telnet VT100"
- In reply to: Niki Estner: "Re: how to make a decimal a power of ten?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|