[Java lista] ket alap kerdes
Zoltan Mozes
Zoltan_Mozes at epam.com
2007. Feb. 14., Sze, 10:03:23 CET
TABLE 1 . 2 Primitive Data Types and Their Effective Sizes
Type Effective Representation Size (bits)
byte 8
int 32
>>>>>float 32
char 16
short 16
long 64
>>>>double 64
Complete Java® 2
Certification: Study Guide,
Fifth Edition
Philip Heller
Simon Roberts
SYBEX®
Best Regards,
Zoltán Mózes
EPAM Systems
Budapest office, Hungary (GMT+1)
Office phone: +36 (1) 327-74-XX
Office fax: +36 (1) 327-74-20
Mobile phone: +36 (20) XXX-XXX
E-mail: Zoltan_Mozes at epam.com
http://www.epam.com
CONFIDENTIALITY CAUTION AND DISCLAIMER
This message is intended only for the use of the individual(s) or entity(ies) to which it is addressed and contains information that is legally privileged and confidential. If you are not the intended recipient, or the person responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. All unintended recipients are obliged to delete this message and destroy any printed copies.
-----Original Message-----
From: javalist-bounces at javagrund.hu [mailto:javalist-bounces at javagrund.hu] On Behalf Of Fisha
Sent: Wednesday, February 14, 2007 9:06 AM
To: javalist at javagrund.hu
Subject: Re: [Java lista] ket alap kerdes
Hello!
Ez rendben is van, de mi okozza a kulonbseget ezek kozt az esetek
kozt:
double a = 2.36;
double b = 2.36f;
float d = 2.36f;
eredmeny:
2.36
2.359999895095825 (ez ugy tunik, hogy valamitol meg fugg is, hogy
merre kerekedik, mert egy masik gepen probalva mast adott)
2.36
Koszi mindenkinek a segitseget,
Fisha mailto:fisha at freemail.hu
> Hali!
>>1. Szamabrezolosdi:
>>
>>a kod:
>>double i = 2.65f;
>>System.out.println(i);
>>
>>az eredmeny:
>>2.6500000953674316
>>
>>Gondolom, hogy a binaris abrazolas pontatlansagabol ered a problema.
>>De orulnek, ha valaki pontosan le tudna irni, hogy mi is tortenik a
>>hatterben valojaban.
> Semmi nem tortenik :). Kettes szamrendszerben a tort helyiertekek ugye
> ugy
> neznek ki, hogy 1/2 1/4 1/8 1/16, stb. Ezeknek az osszegebol kene
> osszerakni
> a tortetedet, es azt pont nem lehet. (Ahogy mondjuk a 0.1-et sem. Vagy
> az 1/3-ot
> 10-es szamrendszerben, pedig 3-asban sima ugy :) )
> http://en.wikipedia.org/wiki/IEEE_754
> Ba'ly,
> Atleta
_______________________________________________
Javalist mailing list
Javalist at javagrund.hu
http://javagrund.hu/mailman/listinfo/javalist
További információk a(z) Javalist levelezőlistáról