🔒 Closed Question about double and float data type in java

Status
Not open for further replies.
Ito ts baka makatulong to at baka masagutan din yang tanong mo.. ☺
Untitled2.png
Pwede ding masabi na, kapag yung sa declaration ay ganito..
double a = 0.1; //Matik na to na double siya kase yun yung datatype
float b = 0.1; //Matik na din to na float kase sa datatype niya din sa declaration
 
float - 32-bit, can have up to 7 decimal digits
double - 64-bit, precision can go up to 15 decimal digits

float floatMo = 1.005f;
be conscious about the "f"

float a = 1.00000111111111f;
double d = 1.000000111111111111111111;
System.out.println(a);
System.out.println(d);


output:
1.0000011
1.0000001111111112
 
Status
Not open for further replies.

About this Thread

  • 4
    Replies
  • 577
    Views
  • 4
    Participants
Last reply from:
NightJames

Trending Topics

Online now

Members online
1,126
Guests online
987
Total visitors
2,113

Forum statistics

Threads
2,274,711
Posts
28,957,777
Members
1,233,406
Latest member
Jo477
Back
Top