From 32a41b1abe1a4aab0892c9c2051be6ba5b379f1e Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 11 May 2020 22:17:58 +0200 Subject: New upstream version 2.2.0~rc1+repack --- boost/libs/math/example/nonfinite_legacy.cpp | 94 ---------------------------- 1 file changed, 94 deletions(-) delete mode 100644 boost/libs/math/example/nonfinite_legacy.cpp (limited to 'boost/libs/math/example/nonfinite_legacy.cpp') diff --git a/boost/libs/math/example/nonfinite_legacy.cpp b/boost/libs/math/example/nonfinite_legacy.cpp deleted file mode 100644 index 11b84e6a..00000000 --- a/boost/libs/math/example/nonfinite_legacy.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// nonfinite_legacy.cpp - -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt -// or copy at http://www.boost.org/LICENSE_1_0.txt) - -// Copyright (c) 2006 Johan Rade -// Copyright (c) 2011 Paul A. Bristow - -/*! -\file -\brief Basic tests of nonfinite loopback with output and input facet. - -\detail Basic loopback test outputs using the so-called 'legacy' facets, -"1.#INF" and "1.#QNAN". - -and reads back in using nonfinite input 'legacy' facet, and -(if possible) checks if loopback OK. - -*/ - -#include -using boost::math::nonfinite_num_put; -using boost::math::nonfinite_num_get; - -using boost::math::legacy; - -#include -using std::cout; -using std::endl; - -#include -using std::setfill; -using std::setw; - -#include -using std::locale; - -#include -using std::stringstream; -#include -using std::numeric_limits; - -#include - -int main() -{ - // Create a new locale with both the nonfinite facets. - std::locale new_locale(std::locale(std::locale(), - new boost::math::nonfinite_num_put), - new boost::math::nonfinite_num_get); - - { - stringstream ss; - ss.imbue(new_locale); - double inf = numeric_limits::infinity(); - ss << inf; // Write out. - double r; - ss >> r; // Read back in. - - cout << "infinity output was " << inf << endl; - cout << "infinity input was " << r << endl; - - assert(inf == r); - } - { - stringstream ss; - ss.imbue(new_locale); - - double nan = numeric_limits::quiet_NaN(); - ss << nan; // Write out. - double v; - ss >> v; // Read back in. - - cout << "NaN output was " << nan << endl; - cout << "NaN input was " << v << endl; - - // assert(nan == v); // Always fails because NaN == NaN fails! - // assert(nan == numeric_limits::quiet_NaN()); asserts! - } - -} // int main() - -/* - -Output: - -infinity output was 1.#INF -infinity input was 1.#INF -NaN output was 1.#QNAN -NaN input was 1.#QNAN - -*/ - -- cgit v1.2.3