This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Why is this happening?  RSS feed

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


removed parts I've felt unnecessary.. If anyone wants, I can post it..

My problem is :

If I keep on increasing/ changing the value of good and total, like say 1/1, 2/2... it goes properly..
If bad value changes, like
good = 4, bad=1, total=5,
then the result of (good/total) should be 0.8
It is showing zero!!

what am I missing here ??
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
never mind
got it..
it tends to save the intermediate result in "int"

i.e I changed the line :
to


Now I feel so silly, someone tell me how do i delete this message
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to declare good bad in double or float , as you have fefined it as integer its losing its precision values
check it out
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ravindra patil wrote:You need to declare good bad in double or float , as you have fefined it as integer its losing its precision values
check it out



Thank you Mr. Ravindra
I was over this from yesterday night, and now after a minute since posting it, I realized my mistake
How silly it looks
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep it happens ... :0
we learn a lot from mistakes even though its small

cheers
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!