doc_Text.cpp File Reference

#include <stdio.h>
#include <string.h>
#include "doc_Text.hh"
#include "compatibility.hh"
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <assert.h>
#include "floats.hh"
Include dependency graph for doc_Text.cpp:

Go to the source code of this file.

Functions

string scientific2tenpow (double n)
string docT (char *c)
string docT (int n)
string docT (long n)
string docT (double n)
 Add a trailing f when converting double-precision numbers to text if single-precision is required NO, this is no more true for LaTeX documentator.

Variables

bool gInternDoubleSwitch

Function Documentation

string docT ( double  n  ) 

Add a trailing f when converting double-precision numbers to text if single-precision is required NO, this is no more true for LaTeX documentator.

Definition at line 84 of file doc_Text.cpp.

References scientific2tenpow().

00085 {
00086 //    char c[64];
00087 //    if  (n <  0.1 && n > -0.1 && n != 0.0) {
00088 //        //snprintf(c, 63, "%e", n); //, inumix());
00091 //        snprintf(c, 63, "%g", n);
00092 //    } else {
00093 //        snprintf(c, 63, "%g", n);
00094 //        //zdel(c);
00095 //    }
00096 //    return string(c);
00097     return scientific2tenpow(n);
00098 }

Here is the call graph for this function:

string docT ( long  n  ) 

Definition at line 61 of file doc_Text.cpp.

00061 { char c[64]; snprintf(c, 63, "%ld",n); return string(c); }

string docT ( int  n  ) 

Definition at line 60 of file doc_Text.cpp.

00060 { char c[64]; snprintf(c, 63, "%d",n);  return string(c); }

string docT ( char *  c  ) 

Definition at line 59 of file doc_Text.cpp.

Referenced by DocCompiler::compileLateq(), DocCompiler::generateCode(), DocCompiler::generateIota(), DocCompiler::getFreshID(), and DocCompiler::prepareIntervallicUI().

00059 { return string(c); }

Here is the caller graph for this function:

string scientific2tenpow ( double  n  ) 

Definition at line 100 of file doc_Text.cpp.

Referenced by docT().

00101 {
00102     char tmp[64];
00103     string entree = " * 10^{";
00104     char sortie = '}';
00105     string s;
00106     string::size_type ps;
00107     
00108     snprintf(tmp, 63, "%.15g", n); // Warning: over 15 decimals, results are wrong !!
00109 //  snprintf(tmp, 63, "%f", n);
00110     
00111 //  cerr << "doc_Text.cpp : scientific2tenpow : " << n << " -> \"" << tmp << "\"" << endl;
00112     s = tmp;
00113     ps = s.find('e');
00114     
00115     if (ps != string::npos) {
00116         s.replace(ps, 1, "");
00117         s.insert(ps, entree);
00118         s += sortie;
00119     }
00120     else {
00121         //cerr << "doc_Text.cpp : scientific2tenpow : \'e\' non trouvé" << endl;
00122     }
00123         
00124     return s;
00125 }

Here is the caller graph for this function:


Variable Documentation

Generated on Thu Jul 15 16:15:38 2010 for FAUST compiler by  doxygen 1.6.3