From: Paulo Soeiro Date: 2006-12-17T22:04:50+09:00 Subject: Re: Float numbers comparison ------=_Part_1412_16918937.1166360686643 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thank you very much. Paulo Soeiro On 12/17/06, mathew wrote: > > On 12/16/06, Paulo Soeiro wrote: > > Thank you all for your awnsers, i haven't read them all. But i don't see > > this problem occurring in java language, when comparing 1.9 with 1.8+0.1 > . > > A Ruby float is a 64 bit float using your system's native floating > point support. > > A Java float is a 32 bit float using Java's independent implementation > of IEEE 754. > > To make your Java code comparable to the Ruby code, replace "float" > with "double". When I do that I get many repetitions of: > > a-b=-2.220446049250313E-16 > false > > just like with Ruby. > > > mathew > -- > > > ------=_Part_1412_16918937.1166360686643 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thank you very much.

Paulo Soeiro

On 12/17/06, mathew <meta@pobox.com> wrote:
On 12/16/06, Paulo Soeiro <pcsoeiro@gmail.com> wrote:
> Thank you all for your awnsers, i haven't read them all. But i don't see
> this problem occurring in java language, when comparing 1.9 with 1.8+0.1.

A Ruby float is a 64 bit float using your system's native floating
point support.

A Java float is a 32 bit float using Java's independent implementation
of IEEE 754.

To make your Java code comparable to the Ruby code, replace "float"
with "double". When I do that I get many repetitions of:

a-b=-2.220446049250313E-16
false

just like with Ruby.


mathew
--
<URL:http://www.pobox.com/~meta/ >


------=_Part_1412_16918937.1166360686643--