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: Tue, 09 Aug 2011 01:08:25 +0200 Organization: albasani.net Lines: 53 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 NBiHmOmhF50MvgAosGPij+sgqxZWdLzk1i0yG9cNhlbWGaBmtl71Fsr1lvGj6KR2l0bkk6WeYA2RezNCFYuqOA== NNTP-Posting-Date: Mon, 8 Aug 2011 23:08:28 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="OlAlM5az0nTh1VS6AzNm0vus2QG6qkaHtl1eT9v+4FY6piq06oFaQILzNveIcixOUarf71HzuC+x8dTFosVv3Yy3ui2SHGo0tMZLeA8/MoFnRMsydXLFPgxMdAlj0jBA"; 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:sSSFzVig5g7wuwBPpK98nNpw/BA= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6883 BGB schrieb: > division is mostly calculating the reciprocal of the second value, and > multiplying the first by this (can be done using Newton's Method). I don't know exactly what you understand by this algorithm. But if I understand this as calculating the reciprocal first adn then multiplying, you will have as a result: o(x*o(1/y)) Instead of o(x/y). you will usually get less accurate results since by the reciprocal-math option method two approximations will be involved. This is just a guess from the hip. But here you see a simple excel verifying the claim: 1 2 3 4 5 6 7 8 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 5 0.00 0.00 0.00 0.00 0.00 -0.01 -0.01 0.00 6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 7 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 8 0.00 0.00 0.01 0.00 0.00 -0.01 0.00 0.00 Used formula: =ROUND($G6/H$5;2)-ROUND($G6*ROUND(1/H$5;3);2) 1 2 3 4 5 6 7 8 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3 0.00 0.00 0.01 0.00 0.00 0.01 0.00 0.00 4 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 5 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 6 0.00 0.00 0.01 0.00 0.00 0.01 0.00 0.00 7 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 8 0.00 0.00 0.00 0.00 0.00 0.01 0.01 0.00 Used formula: =FLOOR($G6/H$5;2)-FLOOR($G6*FLOOR(1/H$5;3);2) Errors are also seen for larger numbers of digits. Bye