File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Math.max doubt

 
Shruti Bakshi
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

float f1 = Math.max(19.0f,9842316834236482L);

compiles and runs fine.I do not understand how the type conversion is working here.Please help !
 
Steven Bell
Ranch Hand
Posts: 1071
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the API docs for the Math class. There is no method that takes (float, long) as arguments to it looks for the best match signature. Since a long can be automatically cast to float it calls the (float, float) version. Note that there may be precision loss in the conversion from long to float.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic