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: Sun, 11 Sep 2011 13:50:53 +0200 Organization: albasani.net Lines: 50 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net e/NogbjflBgAqeBVwUC6Jyj7Jz/l/rgBBWUr2KKwKcwc8tWY+W5QwMReJBp9orGBirHN2y27wVrJ/+GFyTYP2A== NNTP-Posting-Date: Sun, 11 Sep 2011 11:50:54 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="WpjpMy9kWJGwWr0VisvLrVgF7c66CGg7R5GAnBl40XzEx9jLDrdFokzGeY6cDtOM15BCm9KBem2BHzluzmsETqtKE+M0RvbVoW5ZcaGhstDDDVjukYpiwu0M2XQhdY7o"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Firefox/6.0.2 SeaMonkey/2.3.3 In-Reply-To: Cancel-Lock: sha1:gFlXQSe1Oy6ELtj1d6WnJLRLqvE= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7790 Jan Burse schrieb: > N[sin[3.14159265358979324],18] = > > -1.53735661672049712×10^-18 Oops, just reading: http://reference.wolfram.com/mathematica/tutorial/MachinePrecisionNumbers.html So the second N[.,.] was not necessary. Could simply do, but the output on Wolfram alfa looks a little bit different: sin[3.14159265358979324] = -1.53736... ×10^-18 Or could try the following: N[sin[314159265358979324 / 100000000000000000],9] = -1.53735662×10^-18 N[sin[314159265358979324 / 100000000000000000],18] = -1.53735661672049712×10^-18 N[sin[314159265358979324 / 100000000000000000],36] = -1.53735661672049711580283060062489418×10^-18 Note how good the high precision computation is. The lower precision number is always the rounding of the higher precision number. But mechanics for high precision numbers look a little bit more complicated to me than BigDecimal. At least if I look at: http://reference.wolfram.com/mathematica/tutorial/ArbitraryPrecisionNumbers.html There is a max extra precision, which is needed in the evaluation function N[.,.]. BigDecimal does not know about evaluation functions. And there is some special handling of near zero values. Bye