KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Every time I think I understand about casting and conversions, I find another strange behavior. long l = 123456789L; float f = l; System.out.println(f); // outputs 1.23456792E8 Given that a long has greater bit-depth than a float , I would expect that an explicit cast would be required in order for this to compile. And not surprisingly, we see that we have lost precision in the result. Why is a cast not required here?
Tags (comma-separated)
Save Edits
Cancel