Rounding Singles

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In C++, I was able to use this line of code (do not ask what about the object
names--its for a game).

reduce = AtkUnit.Hull / 100;

To get a percentage to porportionally reduce another integer (the idea is
that the integer is reduced to how much HP it has). In VB .NET, however, it
rounds when I use the same line of code (without the semicolon, of course) or
when I use

reduce = AtkUnit.hull \ 100

it automatically rounds to zero (or one) so I dont get the decimal
percentage that I need. Any help? Did I make an error?
 
reduce = Math.Floor(AtkUnit.Hull / 100)

I was just complaining about this exact behavior in another thread.
:-)


HTH,

Sam
 
Chaos,

This and other dotnet newsgroups have it seems yesterday and today the
subject "the differences in dividing between C and VBNet".

They are really differend.

I think the best is to try or/and to read the documentation, don't try to
compare what is done in C with VBNet.

When you are using VBNet and try to do that in a way as in C, is it the same
as something as trying to ride in a car in the same way as if it was a
tractor.

Just my thought,

Cor
 
So true, but don't you expect when you do a single operator command that it
actually divides? You tell it to divide, so it should divide. Its like a
calculator. All calculators divide the same way.
 
Back
Top