public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/8949: numeric_limits<>::denorm_min() and is_iec559 problems.
@ 2002-12-15 10:55 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2002-12-15 10:55 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, johnb, nobody, paolo

Synopsis: numeric_limits<>::denorm_min() and is_iec559 problems.

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sun Dec 15 10:55:46 2002
Responsible-Changed-Why:
    Analyzed.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sun Dec 15 10:55:46 2002
State-Changed-Why:
    First half (denorm_min()), already fixed for 3.3, it isn't
    a regression and probably the fix will not be backported
    to 3.2.x. Second half (is_iec559), confirmed everywhere as
    a bug in my reading (see 18.2.1.2, 53 and 18.2.1.5, 1),
    easy to patch as soon as the mainline reopens.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8949


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/8949: numeric_limits<>::denorm_min() and is_iec559 problems.
@ 2002-12-16 11:56 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2002-12-16 11:56 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, johnb, paolo

Synopsis: numeric_limits<>::denorm_min() and is_iec559 problems.

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Mon Dec 16 11:56:40 2002
State-Changed-Why:
    Fixed for 3.3 and 3.4.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8949


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/8949: numeric_limits<>::denorm_min() and is_iec559 problems.
@ 2002-12-15  6:46 johnb
  0 siblings, 0 replies; 3+ messages in thread
From: johnb @ 2002-12-15  6:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8949
>Category:       libstdc++
>Synopsis:       numeric_limits<>::denorm_min() and is_iec559 problems.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 15 06:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Eugeny Belov
>Release:        gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
I found some problems with numeric_limits class:

1. In case denormalization is not presented (numeric_limits<>::has_denorm == false) numeric_limits<float;double;long double>::denorm_min() should be equal to corresponding numeric_limits<float;double;long double>::min(). (minimum positive normalized value, see ISO|IEC 14882 14882 "C++" 18.2.1.2(49-51))

  As an effect there is:

2. numeric_limits<float;double;long double>::denorm_min()
should be > 0.0 as stated in ISO|IEC 10967-1 "Language Independend Arithmetic" (see also ISO|IEC 14882 "C++" 18.2.1.2(49-51))

3. Possibly I am wrong here, but please look also for is_iec559 member for short,int,long types, it looks that these types shouldn`t have it set to true.

See small testcase attached also.
>How-To-Repeat:
Compile and run testcase with g++. You`ll see some failed messages.

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="test18_2.cpp"
Content-Disposition: inline; filename="test18_2.cpp"

#include <limits>
#include <cassert>
#include <iostream>

using namespace std;

#define CHK(condition)  if (!(condition)) printf ("check for: %s : Failed!\n",#condition);


int main(int, char *[])
{

    CHK(0 <  numeric_limits<float>::denorm_min());
    CHK(0 <  numeric_limits<double>::denorm_min());
    CHK(0 <  numeric_limits<long double>::denorm_min());

    if (numeric_limits<float>::has_denorm == denorm_absent)
      CHK( numeric_limits<float>::denorm_min() ==  numeric_limits<float>::min());

    if (numeric_limits<double>::has_denorm == denorm_absent)
     CHK( numeric_limits<double>::denorm_min() == numeric_limits<double>::min());

    if (numeric_limits<long double>::has_denorm == denorm_absent)
     CHK( numeric_limits<long double>::denorm_min() == numeric_limits<long double>::min());

    CHK(! numeric_limits<short>::is_iec559);
    CHK(! numeric_limits<unsigned short>::is_iec559);
    CHK(! numeric_limits<int>::is_iec559);
    CHK(! numeric_limits<unsigned int>::is_iec559);
    CHK(! numeric_limits<long>::is_iec559);
    CHK(! numeric_limits<unsigned long>::is_iec559);


  return (0);
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-16 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-15 10:55 libstdc++/8949: numeric_limits<>::denorm_min() and is_iec559 problems paolo
  -- strict thread matches above, loose matches on Subject: below --
2002-12-16 11:56 paolo
2002-12-15  6:46 johnb

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).