public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: nejataydin@superonline.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/4434: the value of float epsilon is wrong
Date: Mon, 01 Oct 2001 06:16:00 -0000	[thread overview]
Message-ID: <200110011310.f91DAgZ00969@localhost.localdomain> (raw)

>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:


                 reply	other threads:[~2001-10-01  6:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200110011310.f91DAgZ00969@localhost.localdomain \
    --to=nejataydin@superonline.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).