Article View: microsoft.public.USASalesInfo.Developer.VisualC++
Article #2Re: Error in Microsoft Visual C++ v5, Borland C++ v5.01, JDK v1.1.5 when using "double" as type.
From: Albert Lo
Date: Tue, 17 Mar 1998 00:00
Date: Tue, 17 Mar 1998 00:00
96 lines
3115 bytes
3115 bytes
This is a multi-part message in MIME format.
--------------06CE2E4F19343B17A6D33D99
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I think your bug means the following output for "expected" zero.
The reason should be same to that we never compare floating point number
with zero.
It depends on the precision of IEEE format of floating point number.
Symantec Java! ByteCode Compiler Version 1.02e
Copyright (C) 1996 Symantec Corporation
-1
-0.9
-0.8
-0.7
-0.6
-0.5
-0.4
-0.3
-0.2
-0.1
-1.38778e-016
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Azri Nielsen-Ferreira wrote:
> There seems to be an error when using a the type "double" in C++ or
> Java. I have tested the program on PowerBuilder and Lotus Notes and
> both have the same error as Borland C++ v5.01, Microsoft Visual C++
> v5. I have tried the program with JDK v1.1.5 and Borland JBuilder too
> and they also have the same problem.
>
> Look at the following program and test it with your compiler
>
> C++ example:
>
> #include <iostream.h>
> void main(void)
> {
> for (double d=-1.0;d<1.0;)
> {
> cout << d << endl;
> d=d+0.1;
> }
> }
>
> Java example:
>
> public class doubleTest
> {
> public static void main(String args[])
> {
> for (double d=-1.0;d<1.0;)
> {
> System.out.println(d);
> d=d+0.1;
> }
> }
>
> }
>
> Best regards, Azri Nielsen-Ferreira
> E-mail: dkdacanf@ibmmail.com
--------------06CE2E4F19343B17A6D33D99
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Albert Lo
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Albert Lo
n: Lo;Albert
email;internet: albertlo@netvigator.com
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------06CE2E4F19343B17A6D33D99--
Technical Details
Message-ID:
<350E8AC4.AC8A6ACA@netvigator.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34fed1be.3599015@news.uni-c.dk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8d38,982e935b1f8b3f3e X-Google-Attributes: gidf8d38,public X-Google-Thread: f5d71,982e935b1f8b3f3e X-Google-Attributes: gidf5d71,public X-Google-Thread: 109b8e,982e935b1f8b3f3e X-Google-Attributes: gid109b8e,public X-Google-Thread: 109fba,982e935b1f8b3f3e X-Google-Attributes: gid109fba,public X-Google-Thread: 10a146,982e935b1f8b3f3e X-Google-Attributes: gid10a146,public From: Albert Lo <albertlo@netvigator.com> Subject: Re: Error in Microsoft Visual C++ v5, Borland C++ v5.01, JDK v1.1.5 when using "double" as type. Date: 1998/03/17 Message-ID: <350E8AC4.AC8A6ACA@netvigator.com> X-Deja-AN: 334901421 References: <34fed1be.3599015@news.uni-c.dk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------06CE2E4F19343B17A6D33D99" Organization: Netvigator Newsgroups: microsoft.public.USASalesInfo.Developer.VisualC++,comp.lang.java.programmer,comp.lang.java,comp.lang.c++,borland.public.cpp.language