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: Sat, 06 Aug 2011 21:24:25 +0200 Organization: albasani.net Lines: 41 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 j8cobMuUknF/rRPJNoCdgwoz6wxSJyRKxXGBfWpVOh1d8uXuofeRTCiYb5PrPc7fwKFYY+J6KxuNOhyEecNnxA== NNTP-Posting-Date: Sat, 6 Aug 2011 19:24:27 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="jrczJIbIxehyl0zpv0WMtIEa4xCRBCKhzq2NW1kduPhRdRDeyRPThM4OzajBsYLupeWB80k/F9Kt2lJozZl0Zqr90yZXXz63ZZlYAw22aT5nmxzfb61qLx6HXcXQaezB"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110706 Firefox/5.0 SeaMonkey/2.2 In-Reply-To: Cancel-Lock: sha1:zI/hYVrIggjn6vZkpeFTwILx/20= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6828 Stefan Ram schrieb: > Jan Burse writes: >> IEEE allows to internally calculate with additional bits. >> Is it possible to have awailable these ops? Like an add >> with this higher precision? How could we store such a >> result? Would there be a wrapper like Double? > > See also: > > http://en.wikipedia.org/wiki/Strictfp > > . > Motivating example, in Go we have: func main() { x := math.Sin(2*math.Pi) fmt.Printf("x = %.30f, is zero = %v\n", x, x == 0) } x = 0.000000000000000000000000000000, is zero = true In Java we have: public static double zero1() { return Math.sin(2*Math.PI); } public static double zero2() { return StrictMath.sin(2*StrictMath.PI); } public static void main(String[] args) { System.out.println("zero1="+zero1()); System.out.println("zero2="+zero2()); } zero1=-2.4492935982947064E-16 zero2=-2.4492935982947064E-16