By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

truncating decimal on numbers

P: n/a
cj
I want 7 * .105263 to result in an int32 value of 0. and 7 * .189021 to
result in an int32 value of 1.

I don't want to round. How can I just drop the decimal places?
Nov 8 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
cj
never mind--I knew as soon as I asked I'd find the answer. Sometimes
I'm tempted to ask just because I know I'll find the answer as soon as I
hit send.

Int or Fix is what I wanted.
cj wrote:
I want 7 * .105263 to result in an int32 value of 0. and 7 * .189021 to
result in an int32 value of 1.

I don't want to round. How can I just drop the decimal places?
Nov 8 '06 #2

P: n/a
"cj" <cj@nospam.nospamschrieb:
>I want 7 * .105263 to result in an int32 value of 0. and 7 * .189021 to
result in an int32 value of 1.

I don't want to round. How can I just drop the decimal places?
Check out 'Fix', 'Int', and 'Math.Floor' and 'Math.Ceil'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 8 '06 #3

P: n/a
CJ,

You can always use it as string and than cut the decimals you don't want
using the IProvider from ToSring. Is as well an easy way to round in any way
you want.

CJM

"cj" <cj@nospam.nospamschreef in bericht
news:O8**************@TK2MSFTNGP02.phx.gbl...
>I want 7 * .105263 to result in an int32 value of 0. and 7 * .189021 to
result in an int32 value of 1.

I don't want to round. How can I just drop the decimal places?

Nov 9 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.