]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/6.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ostream / inserters_arithmetic / char / 6.cc
CommitLineData
23cac885
BK
1// 1999-11-15 Kevin Ediger <kediger@licor.com>
2// test the floating point inserters (facet num_put)
b2dad0e3 3
aa118a03 4// Copyright (C) 1999-2014 Free Software Foundation, Inc.
b2dad0e3
BK
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
748086b7 9// Free Software Foundation; either version 3, or (at your option)
b2dad0e3
BK
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
748086b7
JJ
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
b2dad0e3 20
a5ea7a0b
RS
21// { dg-do run { xfail lax_strtofp } }
22
23cac885
BK
23#include <cmath> // for abs
24#include <cfloat> // for DBL_EPSILON
b2dad0e3 25#include <sstream>
23cac885 26#include <limits>
fe413112 27#include <testsuite_hooks.h>
b2dad0e3 28
23cac885 29// libstdc++/9151
ba4b172f 30void
23cac885 31test06()
b2dad0e3 32{
ba4b172f 33 using namespace std;
11f10e6b 34 bool test __attribute__((unused)) = true;
ba4b172f 35
23cac885
BK
36 int prec = numeric_limits<double>::digits10 + 2;
37 double oval = numeric_limits<double>::min();
38
39 stringstream ostr;
40 ostr.precision(prec);
41 ostr << oval;
42 string sval = ostr.str();
43 istringstream istr (sval);
44 double ival;
45 istr >> ival;
46 VERIFY( abs(oval-ival)/oval < DBL_EPSILON );
23cac885 47}
b2dad0e3 48
23cac885
BK
49int
50main()
b2dad0e3 51{
23cac885 52 test06();
04d930e6 53 return 0;
b2dad0e3 54}