• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Long to Float conversion

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,
I have a very basic doubt as to how can a conversion from long to float not require any explicit casting or why is it known as widening conversion?
Long is 64 bits and float is 32 bits so doesn't the number get truncated when a cast occurs?
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are a couple of previous threads that discuss this issue:
https://coderanch.com/t/236562/java-programmer-SCJP/certification/widening-conversion-narrowing-conversion
and
https://coderanch.com/t/235941/java-programmer-SCJP/certification/long-Vs-float-double
 
reply
    Bookmark Topic Watch Topic
  • New Topic