Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: higher precision doubles Date: Mon, 08 Aug 2011 19:29:13 +0200 Organization: albasani.net Lines: 52 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net mfuXyzxRtiRMeJt2ivmutpy/7MOtC3NgEvCCH5Chd433XzkA4dyLEBl/EvjNBq7fDqjeAA1Ly/l3fqwojiRhSg== NNTP-Posting-Date: Mon, 8 Aug 2011 17:29:15 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="me916QaPSYm1E4c+STiw6gzBOxLxlSH3HzJfvWeGx/X9FjDKboRd9fDKldRFhDeNydZ1v7yiO7uT4DM77LpKB1dLJpeJ0k2uc09GBRp6t46LnvONIpbyKzE37uIpaXaB"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110706 Firefox/5.0 SeaMonkey/2.2 In-Reply-To: Cancel-Lock: sha1:lpklNNSoPnpAppNMGWrb45xXUkM= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6873 BTW: Hope that the drop of indexes (shares, currency, etc..) is not a problem of float calculation in todays high frequency trading. The following slides mention such a problem: http://www.cl.cam.ac.uk/~jrh13/slides/jnao-02jun06/slides.pdf Quote: Page 2 "Naive use of floating-point arithmetic In 1982 the Vancouver stock exchange index was established at a level of 1000. A couple of years later the index was hitting lows of around 520. The cause was repeated truncation of the index to 3 decimal digits on each recalculation, several thousand times a day. On correction, the stock index leapt immediately from 574.081 to 1098.882." Jan Burse schrieb: > Hi > > Just assume I want to put the functionality into an Applet. Means > somehow the aspect of supporting a couple of plattforms and > architectures is important. > > According to stack overflow there are a couple of solutions around: > http://stackoverflow.com/questions/6979926/higher-precision-doubles-and-trigonometric-functions-in-java > > Apfloat and JScience. > > I guess creating objects and then dropping them again is not so > much a problem in modern VMs. At least I saw recently that for > example the 64-bit JDK is very good in continously reclaiming > such objects. And there are also papers that show that the Java > GC is more efficient than a typical C malloc/free, for some Java > specific reasons how the heap supplies objects. > > Also one could implement mutable objects (instances) instead of > value objects (instances). So that instead of an API of the form: > > myMath: > myImmutableObjectClass sin(myImmutableObjectClass x); > > One could also do: > > myMath: > sin(myMutableObjectClass x, myMutableObjectClass res); > > And thus safe some object creations programmatically by reusing > objects were appropriate. > > Bye