Commit 70434ca3 authored by snuverink_j's avatar snuverink_j
Browse files

use c++11 std__math methods instead of own classes

parent ee231a93
#ifndef OPAL_NumToStr_HH
#define OPAL_NumToStr_HH 1
// ------------------------------------------------------------------------
// $RCSfile: NumToStr.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.2.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// ------------------------------------------------------------------------
//
// $Date: 2004/11/12 20:10:12 $
// $Author: adelmann $
//
// ------------------------------------------------------------------------
#include <sstream>
#include <string>
/// Convert number to string.
// Return the string corresponding to the numeric argument.
template <typename T>
std::string NumToStr(T t) {
std::ostringstream oss;
oss << t;
return oss.str();
}
#endif // OPAL_NumToStr_HH
// ------------------------------------------------------------------------
// $RCSfile: Round.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Function: double Round(double)
// Round to nearest integer.
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:48 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------
#include "Utilities/Round.h"
#include <cmath>
double Round(double value) {
return (value < 0.0) ? ceil(value - 0.5) : floor(value + 0.5);
}
#ifndef OPAL_Round_HH
#define OPAL_Round_HH 1
// ------------------------------------------------------------------------
// $RCSfile: Round.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Function: double Round(double)
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:48 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------
/// Round the double argument.
// Return the nearest integer (as a double).
double Round(double value);
#endif // OPAL_Round_HH
// ------------------------------------------------------------------------
// $RCSfile: Truncate.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Function: double Truncate(double)
// Truncate towards zero.
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:48 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------
#include "Utilities/Truncate.h"
#include <cmath>
double Truncate(double value) {
return (value < 0.0) ? ceil(value) : floor(value);
}
#ifndef OPAL_Truncate_HH
#define OPAL_Truncate_HH 1
// ------------------------------------------------------------------------
// $RCSfile: Truncate.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Function: double Truncate(double)
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------
/// Truncate.
// Truncate the double argument, i.e. round towards zero.
// Return the result as a double.
double Truncate(double value);
#endif // OPAL_Truncate_HH
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment