public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/4434: the value of float epsilon is wrong
@ 2001-10-01  6:16 nejataydin
  0 siblings, 0 replies; only message in thread
From: nejataydin @ 2001-10-01  6:16 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4434
>Category:       c++
>Synopsis:       the value of float epsilon is wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 01 06:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Nejat AYDIN
>Release:        3.0.1
>Organization:
>Environment:
System: Linux localhost.localdomain 2.2.16-22 #1 Tue Aug 22 16:16:55 EDT 2000 i586 unknown
Architecture: i586

	
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ../src/gcc-3.0.1/configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
>Description:
	
The command line is simply "g++ eps.cc" and there is no compiler output.

Below is the source code (the file "eps.cc")

/************************ Source Code ***********************/
#include <iostream>
#include <limits>

using namespace std;

int main()
{
   cout << "float epsilon == "
        << numeric_limits<float>::epsilon() << endl;

   cout << "double epsilon == "
        << numeric_limits<double>::epsilon() << endl;

   cout << "long double epsion == "
        << numeric_limits<long double>::epsilon() << endl;
}
/***************** End of Source Code *********************/

Output of the program is

float epsilon == 2
double epsilon == 2.22045e-16
long double epsion == 1.0842e-19

which is the float epsilon is an obviously wrong value,
while other epsilon values are plausible.

>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-10-01  6:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-01  6:16 c++/4434: the value of float epsilon is wrong nejataydin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).