OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [18_support/] [numeric_limits/] [traps.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// { dg-options "-mieee" { target alpha*-*-* } }
2
// { dg-options "-mieee" { target sh*-*-* } }
3
 
4
// Copyright (C) 2005 Free Software Foundation
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 2, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING.  If not, write to the Free
19
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20
// USA.
21
 
22
// 18.2.1.1 template class numeric_limits
23
 
24
#include <limits>
25
#include <testsuite_hooks.h>
26
 
27
template<typename T>
28
  void
29
  test_traps(T r = T(0))
30
  {
31
    typedef T value_type;
32
    volatile value_type i(5);
33
    volatile value_type j(0);
34
 
35
    if (!std::numeric_limits<value_type>::traps)
36
      r = i / j;
37
  }
38
 
39
// libstdc++/22203
40
int main()
41
{
42
  test_traps<int>();
43
  test_traps<unsigned int>();
44
  test_traps<long>();
45
  test_traps<unsigned long>();
46
  test_traps<long long>();
47
  test_traps<unsigned long long>();
48
 
49
  /*
50
    For floating points, trapping is a different, more complicated
51
    story.  If is_iecxxx is true, then division by zero would not trap
52
    (infinity).  If is_iecxxx is false, we don't know (VAX may trap for
53
    0/0 -- I have to check).  For most cases (i.e. IEE-754), trapping
54
    for floating points have to do with whether there is a support for
55
    signaling NaN.
56
    - Gaby.
57
  */
58
  //  test_traps<float>();
59
  //  test_traps<double>();
60
  //  test_traps<long double>();
61
 
62
  return 0;
63
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.