🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15110

Re: Question about mathemathics.

#15110
From: Hakan UNLU
Date: Fri, 09 Jul 1999 00:00
32 lines
1605 bytes
Sometimes binary representation of a decimal number cannot be done
using the number of bits available in a float datatype (usually it is an
infinite series of bits)

The solution might be using a class that uses decimal representation instead
like java.math.BigDecimal.

These classes use decimal representation inside and better in making the
sort of calculations that precision is important.
--
Hakan UNLU
Hitit Computer Services
-------------------------------------------------------------
Visit my virtual bookstore at
http://surf.to/hakan-books
------------------------------------------------------------
Alexander Stanev <a_stanev@iname.com> wrote in message
news:7m25jr$heu6@forums.borland.com...
> What is wrong with Java mathematics?
> I wrote:
> double x = 1.255;
> double y = 0;
> y = x + 0.005;
> As a rezult I receive y = 1.2599999999999998.
> Why?
> When I use float everything is allwrite, but compiler enforce me to cast
to
> float allmost everything.
> Thank You in advance and excuse me for my english.
> Alex.
>
>
Technical Details
Message-ID: <7m41j2$ioh21@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7m25jr$heu6@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,f8b18e8225438be9
X-Google-Attributes: gidf74b3,public
From: "Hakan UNLU" <hunlu@yahoo.com>
Subject: Re: Question about mathemathics.
Date: 1999/07/09
Message-ID: <7m41j2$ioh21@forums.borland.com>
X-Deja-AN: 498982116
References: <7m25jr$heu6@forums.borland.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.language