Math vb.net
Just noticed something wierd in vb.net
statement like
pc = 25, Pr = 1
PC = test * Pr / 100.0
returns .24
however 25*1/100 returns .25
How do you prevent this and what causes it !!!!!
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hirendra SisodiyaPosted Feb 1, 2011, 9:11 AM
Dim pc As Decimal = 25
Dim Pr As Decimal = 1
Dim test As Decimal = pc * Pr / 100
test = 25 * 1 / 100
i checked both case and both give same result .25.....
Ray DeckerPosted Jan 31, 2011, 6:29 PM
dim PC, PR as decimal
Hirendra SisodiyaPosted Jan 31, 2011, 2:16 AM
what are type and value of PC,Pr and test
?
Suthish NairPosted Jan 31, 2011, 1:26 AM
you are passing value from variable test