I have 2 examples, I don't know what java really acts:
Java will turn that (x=true) and (y=false). So, please tell me what java do in 2 above statements, please.Code:boolean x = 4.45f==4.45;
boolean y=4.44f==4.44;
thanks :)
Printable View
I have 2 examples, I don't know what java really acts:
Java will turn that (x=true) and (y=false). So, please tell me what java do in 2 above statements, please.Code:boolean x = 4.45f==4.45;
boolean y=4.44f==4.44;
thanks :)
Those boolean results imply that the float and double representations for 4.45 are identical while a float value 4.44 cast to type double differs from a double type value 4.45. Read this article.
kind regards,
Jos
@: JosAH, thank for your kindly help. But can you tell me more shortly, please. I think this problem come from what java work. Because in C/C++, above code will output false for two case, too :D
@:I don't like your document you give to me, not because it's long, or not because it's hard. I don't like it because: It's long, and many part of this document seem easy to me (maybe because It belongs to math, and I love it). So, I hard to find what I need :(
thanks :)
He did tell you, it has to do with java's float and double representations. Read that document, completely, and you will understand.
Oh, so thank for your help :PQuote:
He did tell you, it has to do with java's float and double representations. Read that document, completely, and you will understand.
I see no reason why we should repeat (with less accuracy and detail) what is already contained in the document (that you have). Just read it.