Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

floating point literals

 
Mansi Vyas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we need to be familiar with exponent notation for the exam?
e.g. float f = 43e1;
 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I would think so. Its not that difficult though.
Your example, by the way, should be:
e.g. float f = 43e1f;
floating-point numbers are double by default, so you need to indicate its float to assign it to a float variable.
 
Derek Baker
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should probably know this, but what does 43e1 represent? 43^1? 43*10^1? Something like that, I think.
 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually its 43 * 10 expressed in floating-point type numeral. '^' is the bitwise/logical exclusive OR.
 
Derek Baker
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, shouldn't have used that symbol. So that's 43 * (10 to the first power)?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic