source: observatorio/simulacion/ModuloDinamico/utils.H

simulacion
Last change on this file was b208550, checked in by Alejandro <amujica@…>, 9 years ago

agregada precision numerica para la escritura de los xml

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2  Copyright (C) 2014
3  Alejandro Mujica (amujica@cenditel.gob.ve)
4  José Ruiz (jruiz@cenditel.gob.ve)
5  Julie Vera (jvera@cenditel.gob.ve)
6 
7  CENDITEL Fundación Centro Nacional de Desarrollo e Investigación en
8  Tecnologías Libres
9 
10  Este programa es software libre; Usted puede usarlo bajo los términos de la
11  licencia de software GPL versión 2.0 de la Free Software Foundation.
12 
13  Este programa se distribuye con la esperanza de que sea útil, pero SIN
14  NINGUNA GARANTÍA; tampoco las implícitas garantías de MERCANTILIDAD o
15  ADECUACIÓN A UN PROPÓSITO PARTICULAR.
16  Consulte la licencia GPL para más detalles. Usted debe recibir una copia
17  de la GPL junto con este programa; si no, escriba a la Free Software
18  Foundation Inc. 51 Franklin Street,5 Piso, Boston, MA 02110-1301, USA.
19*/
20/*
21  Autor:             Alejandro J. Mujica
22  Fecha de creación: 08/06/2014
23  Este archivo contiene la definición de funciones utilitarias.
24*/
25
26# ifndef UTILS_H
27# define UTILS_H
28
29# include <string>
30# include <sstream>
31
32# define MAX_PRECISION 1E10
33
34template <typename T>
35std::string num_to_str(const T & number)
36{
37  std::stringstream sstr;
38
39  if (number < MAX_PRECISION)
40    sstr.precision(15);
41
42  sstr << number;
43  return sstr.str();
44}
45
46# endif // UTILS_H
47
Note: See TracBrowser for help on using the repository browser.