Mantid
Loading...
Searching...
No Matches
Framework
DataHandling
src
FormattingHelpers.cpp
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2026 ISIS Rutherford Appleton Laboratory UKRI,
4
// NScD Oak Ridge National Laboratory, European Spallation Source,
5
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#include "
MantidDataHandling/FormattingHelpers.h
"
8
9
#include <cmath>
10
#include <iomanip>
11
#include <sstream>
12
13
namespace
Mantid::DataHandling
{
14
15
std::string
formatDouble
(
double
const
value
) {
16
std::stringstream ss;
17
if
(std::fabs(
value
- std::round(
value
)) < 1e-12) {
18
ss << std::fixed << std::setprecision(1) <<
value
;
19
}
else
{
20
ss <<
value
;
21
}
22
return
ss.str();
23
}
24
25
}
// namespace Mantid::DataHandling
value
double value
The value of the point.
Definition
FitMW.cpp:51
FormattingHelpers.h
Mantid::DataHandling
Definition
AlignAndFocusPowderSlim.h:20
Mantid::DataHandling::formatDouble
MANTID_DATAHANDLING_DLL std::string formatDouble(double const value)
Definition
FormattingHelpers.cpp:15
Generated by
1.9.8