Commit 5b324520 authored by Mathieu Giraud's avatar Mathieu Giraud

core/tools.{h,cpp}: fixed_string_of_float

parent 50a90856
#include <algorithm>
#include <iostream>
#include <iomanip>
#include "tools.h"
string seed_contiguous(int k)
......@@ -54,6 +56,13 @@ string string_of_int(int number)
return ss.str();
}
string fixed_string_of_float(float number, int precision)
{
stringstream ss;
ss << fixed << setprecision(precision) << number ;
return ss.str();
}
string scientific_string_of_double(double number)
{
stringstream ss;
......
......@@ -72,6 +72,7 @@ bool pair_occurrence_sort(pair<T, int> a, pair<T, int> b);
string string_of_int(int number);
string fixed_string_of_float(float number, int precision);
string scientific_string_of_double(double number);
/**
......
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