• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calc not working correctly?  RSS feed

 
Krystyna Speer
Greenhorn
Posts: 2
Chrome Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me figure out why this only shows 0 for Celsius?
I'm sure it's something small, but I'm really just not sure what.
 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
5 and 9 both being integers, the result of 5/9 is getting type casted to integer. That means 0.5555555 is getting converted to 0.

Use 5.0/9.0 and test.

Thanks,
Prajakta
 
Krystyna Speer
Greenhorn
Posts: 2
Chrome Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh goodness, I knew it was something simple. It was driving me crazy. Thank you.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!