FAUST compiler  0.9.9.6b8
Functions | Variables
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 ( char *  c)

Definition at line 59 of file doc_Text.cpp.

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

{ return string(c); }

Here is the caller graph for this function:

string docT ( int  n)

Definition at line 60 of file doc_Text.cpp.

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

Definition at line 61 of file doc_Text.cpp.

{ char c[64]; snprintf(c, 63, "%ld",n); return string(c); }
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().

{
//    char c[64];
//    if  (n <  0.1 && n > -0.1 && n != 0.0) {
//        //snprintf(c, 63, "%e", n); //, inumix());
//        snprintf(c, 63, "%g", n);
//    } else {
//        snprintf(c, 63, "%g", n);
//        //zdel(c);
//    }
//    return string(c);
    return scientific2tenpow(n);
}

Here is the call graph for this function:

string scientific2tenpow ( double  n)

Definition at line 100 of file doc_Text.cpp.

Referenced by docT().

{
    char tmp[64];
    string entree = " * 10^{";
    char sortie = '}';
    string s;
    string::size_type ps;
    
    snprintf(tmp, 63, "%.15g", n); // Warning: over 15 decimals, results are wrong !!
//  snprintf(tmp, 63, "%f", n);
    
//  cerr << "doc_Text.cpp : scientific2tenpow : " << n << " -> \"" << tmp << "\"" << endl;
    s = tmp;
    ps = s.find('e');
    
    if (ps != string::npos) {
        s.replace(ps, 1, "");
        s.insert(ps, entree);
        s += sortie;
    }
    else {
        //cerr << "doc_Text.cpp : scientific2tenpow : \'e\' non trouvé" << endl;
    }
        
    return s;
}

Here is the caller graph for this function:


Variable Documentation