UrbanPro
true

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How 4 byte float can store 8 byte long values in java ?

Pankaj Rathi
19/06/2017 0 0

long l = 12464545L;

float f = l; (fine)

int i = l ; (Error)

if we see the how this magic happens as we know the answer lies in the floating point representation as in floating points values does not store directly they store in mainly mantis and exponent part so due to its exponent bit it can actually store a lot more values then a long

for Ex : suppose we have a number 100000000 if we represent in exponential form we will write 10^8 so this number store in 2 part

first part : 10

second part : 8

so this way it can store a lot more values than its same byte size variable

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

What is a Programming Language
What is a Language? Language is a communication system of human. What is a programming Language? A programming Language is a formal constructed language design to communicate...

Programing Languages Learning Tricks
You want to learn that new language or library or framework as soon as possible, right? That’s understandable. Fortunately, there are a handful of tips that can help you to better retain all of that...

Harshal G.

0 0
0

Palindrome Number : Java Function
An easier way to find out whether a number is a Palindrome number or not. Eg. 121, 88, 12321 etc public boolean isPalindrome ( int n ) { int rev = 0, r; for( i = n; i > 0; i /= 10 ) { r...

Use of Service Locator Pattern
If we want to reuse the java code that should be the best approach w.r.t re-usability, maintanence and saving time to concentrate on our own businbess logic/requirement. In the similar approach many patterns...
M

Finding a Majority Element
Problem Description Task. The goal in this code problem is to check whether an input sequence contains a majority element. Input Format. The first line contains an integer, the next one contains a sequence...
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more