Win a copy of Spring Boot in Practice this week in the Spring forum!
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
• Tim Cooke
• Ron McLeod
• Jeanne Boyarsky
• Paul Clapham
Sheriffs:
• Liutauras Vilda
• Henry Wong
• Devaka Cooray
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• Al Hobbs
• Carey Brown
Bartenders:
• Piet Souris
• Mikalai Zaikin
• Himai Minh

# Float

Ranch Hand
Posts: 91
• Number of slices to send:
Optional 'thank-you' note:
I am unable to understand the solution of this Question??

What is the output
{
Float f1 = new Float("4.4e99f");
Float f2 = new Float("-4.4e99f");
Double d1 = new Double("4.4e99");
System.out.println(f1);
System.out.println(f2);
System.out.println(d1);
}

a) Runtime error
b) Infinity
-Infinity
4.4E99
c) Infinity
-Infinity
Infinity
d) 4.4E99
-4.4E99
4.4E99

Greenhorn
Posts: 29
• Number of slices to send:
Optional 'thank-you' note:
reson of this on is that, size of double is larger than float.

Anju sethi
Ranch Hand
Posts: 91
• Number of slices to send:
Optional 'thank-you' note:
I am nt able to understand still ???
Would appreciate if someone explains more and help.

Ranch Hand
Posts: 52
• Number of slices to send:
Optional 'thank-you' note:
floats have a range of something like 1e-45 to 1e38 (positive or negative). So 4.4e99 and -4.4e99 are out of that range, so the value becomes infinity.
[ February 08, 2006: Message edited by: Craig Tyler ]

Anju sethi
Ranch Hand
Posts: 91
• Number of slices to send:
Optional 'thank-you' note:
oh.. dat ways.

thanks