Double # showing 0 on android

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2011-01-08T00:48:29Z Indexed on 2011/01/08 0:53 UTC
Read the original article Hit count: 161

Filed under:
|
|
|

I'm embarrassed to ask this question, but after 45 minutes of not finding a solution I will resort to public humiliation.

I have a number that is being divided by another number and I'm storing that number in a double variable. The numbers are randomly generated, but debugging the app shows that both numbers are in fact being generated.

Lets just say the numbers are 476 & 733. I then take the numbers and divide them to get the percentage 476/733 = .64

I then print out the variable and it's always set to 0. I've tried using DecimalFormat and NumberFormat. No matter what I try though it always says the variable is 0. I know there is something simple that I'm missing, I just can't find it =/.

© Stack Overflow or respective owner

Related posts about android

Related posts about math