Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
HPReal.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* HPReal.cc (C) 2000-2018 */
9/* */
10/* High-precision real number. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15#include "arcane/utils/Iostream.h"
16#include "arcane/utils/HPReal.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27std::istream& HPReal::
28assign(std::istream& i)
29{
30 i >> m_value >> ws >> m_correction;
31 return i;
32}
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37std::ostream& HPReal::
38print(std::ostream& o) const
39{
40 o << m_value << ' ' << m_correction;
41 return o;
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47std::ostream& HPReal::
48printPretty(std::ostream& o) const
49{
50 o << '(' << m_value << ',' << m_correction << ')';
51 return o;
52}
53
54/*---------------------------------------------------------------------------*/
55/*---------------------------------------------------------------------------*/
56
57} // namespace Arcane
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
std::ostream & print(std::ostream &o) const
Writes the instance to the stream o readable by an assign().
Definition HPReal.cc:38
std::istream & assign(std::istream &i)
Reads an HPReal from the stream i. The pair is read in the form of two Real type values.
Definition HPReal.cc:28
std::ostream & printPretty(std::ostream &o) const
Writes the instance to the stream o in the form (x,y).
Definition HPReal.cc:48
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --