Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7779

Re: higher precision doubles

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.lang.java.programmer
Subject Re: higher precision doubles
Date Sat, 10 Sep 2011 21:53:40 -0700
Organization Aioe.org NNTP Server
Lines 34
Message-ID <j4hev1$lho$1@speranza.aioe.org> (permalink)
References <j1hqc1$1ch$1@news.albasani.net> <strictfp-20110806003831@ram.dialup.fu-berlin.de> <j1k4db$1n2$1@news.albasani.net>
Reply-To nma@12000.org
NNTP-Posting-Host 4IuMaYl5j9Y5F74I990LJw.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2
X-Notice Filtered by postfilter v. 0.8.2
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7779

Show key headers only | View raw


On 8/6/2011 12:24 PM, Jan Burse wrote:
>
>
> 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:
>
...
  
>
>
>       zero1=-2.4492935982947064E-16
>       zero2=-2.4492935982947064E-16

Well, both as not correct :)

Here is the correct math answer

Mathematica:

x = Sin[2 Pi]
      
     0

An exact zero. As was created by God. Not a floating point zero.

--Nasser

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Re: higher precision doubles "Nasser M. Abbasi" <nma@12000.org> - 2011-09-10 21:53 -0700
  Re: higher precision doubles Lew <lewbloch@gmail.com> - 2011-09-10 22:22 -0700
    Re: higher precision doubles "John B. Matthews" <nospam@nospam.invalid> - 2011-09-11 05:36 -0400
    Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 13:29 +0200
      Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 13:50 +0200
        Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 14:09 +0200
  Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 10:59 +0200

csiph-web