]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/6.cc
Update copyright years.
[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
a5544970 4// Copyright (C) 1999-2019 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;
ba4b172f 34
23cac885
BK
35 int prec = numeric_limits<double>::digits10 + 2;
36 double oval = numeric_limits<double>::min();
37
38 stringstream ostr;
39 ostr.precision(prec);
40 ostr << oval;
41 string sval = ostr.str();
42 istringstream istr (sval);
43 double ival;
44 istr >> ival;
45 VERIFY( abs(oval-ival)/oval < DBL_EPSILON );
23cac885 46}
b2dad0e3 47
23cac885
BK
48int
49main()
b2dad0e3 50{
23cac885 51 test06();
04d930e6 52 return 0;
b2dad0e3 53}