C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
lx_real.cpp
1 /*
2 ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
3 **
4 ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
5 ** Universitaet Karlsruhe, Germany
6 ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
7 ** Universitaet Wuppertal, Germany
8 **
9 ** This library is free software; you can redistribute it and/or
10 ** modify it under the terms of the GNU Library General Public
11 ** License as published by the Free Software Foundation; either
12 ** version 2 of the License, or (at your option) any later version.
13 **
14 ** This library is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ** Library General Public License for more details.
18 **
19 ** You should have received a copy of the GNU Library General Public
20 ** License along with this library; if not, write to the Free
21 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23 
24 /* CVS $Id: lx_real.cpp,v 1.8 2014/01/30 17:23:47 cxsc Exp $ */
25 
26 /*
27 ** F. Blomquist, University of Wuppertal, 19.09.2007;
28 */
29 
30 #include "lx_real.hpp"
31 #include "lx_interval.hpp"
32 
33 namespace cxsc {
34 
35 inline std::ostream& operator << (std::ostream& s, const lx_real& b) noexcept
36 // A value a of type lx_real is written to the output channel.
37 // The output has the form: {2**(ex),lr}
38 {
39  lx_interval a(b);
40  real p;
41  l_interval m;
42  l_real x;
43 
44  Bin2Dec(a,p,m);
45  x = mid(m);
46 
47  s << "{ "
48  << "10**("
49  << SaveOpt << SetPrecision(0,0) << Fixed << p << RestoreOpt
50  << ")"
51  << "*"
52  << x
53  << " }";
54  return s;
55 }
56 
57 } // end namespace cxsc
cxsc::mid
cvector mid(const cimatrix_subv &mv) noexcept
Returns the middle of the matrix.
Definition: cimatrix.inl:739
cxsc
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition: cdot.cpp:29