61 if (((
x <= fprecision) && (
x >= -fprecision)) ||
69 if ((((
x*i) - ((
int) (
x*i+0.5))) < (fprecision)) &&
70 (((
x*i) - ((
int) (
x*i+0.5))) > (-fprecision))) {
75 sprintf(*ps,
"%d", (
int) (
x*i+0.5));
77 sprintf(*ps,
"%d/%d", (
int) (
x*i+0.5), i);
136 else if (plus_sign) {
158 return (
char*)
strdup((
char *) t);
202 #define POLYNOME_BUFFER_SIZE 20480
214 bool print_plus_sign =
false;
225 print_plus_sign =
true;
231 return (
char*)
strdup((
char *) t);
245 char *s = (
char *)
malloc(6);
249 sprintf(s,
"V%c%c%c%c",
250 (
char) 93 + (i % 26),
251 (
char) 93 + ((i / 26) % 26),
252 (
char) 93 + ((i / 26 / 26) % 26),
253 (
char) 93 + ((i / 26 / 26 / 26) % 26));
299 while (isspace(**ps))
302 }
while (**ps !=
'\0');
312 if (isdigit(**ps) || (**ps ==
'.') || (**ps ==
'+') || (**ps ==
'-')) {
313 sscanf(*ps,
"%f", &coeff);
314 if ((coeff == 0) && (**ps ==
'+'))
316 if ((coeff == 0) && (**ps ==
'-'))
322 if ((**ps ==
'-') || (**ps ==
'+'))
324 while (isdigit(**ps) || (**ps ==
'.') || (**ps ==
'*'))
346 do { *n++ = *((*ps)++); }
347 while (isalnum(**ps) || (**ps ==
':'));
365 bool constructing_monome =
false;
378 if (!constructing_monome) { coeff =
parse_coeff(&s);
381 if (strlen(varname)!=0) {
387 while ((*s ==
'.') || (*s ==
'*')) s++;
389 else varname = (
char*)
strdup(
"TCST");
391 if (constructing_monome) {
398 constructing_monome =
true;
402 if ((*s ==
'+') || (*s ==
'-'))
406 constructing_monome =
false;
void const char const char const int
#define float_to_value(f)
Variable name_to_variable(char *)
bool is_inferior_var(Variable, Variable)
char * vect_sprint_as_monome(Pvecteur v, Pbase b, get_variable_name_t variable_name, char *mult_symbol)
char *vect_sprint_as_monome(Pvecteur v, Pbase b, char * (*variable_name)(), char *mult_symbol): Retou...
Pmonome make_monome(float coeff, Variable var, Value expo)
Pmonome make_monome(float coeff, Variable var, Value expo) PRIVATE allocates space for,...
void monome_rm(Pmonome *ppm)
void monome_rm(Pmonome* ppm) PRIVATE frees space occupied by monomial *ppm returns *ppm pointing to M...
void polynome_monome_add(Ppolynome *ppp, Pmonome pm)
void polynome_monome_add(Ppolynome* ppp, Pmonome pm) PRIVATE Add monomial pm to polynomial *ppp,...
void monome_fprint(FILE *fd, Pmonome pm, Pbase pb, bool plus_sign, char *(*variable_name)(Variable))
void monome_fprint(FILE* fd, Pmonome pm, Pbase pb, bool plus_sign, char* (*variable_name)()) PRIVATE ...
int default_is_inferior_pvarval(Pvecteur *pvarval1, Pvecteur *pvarval2)
bool default_is_inferior_pvarval(Pvecteur * pvarval1, Pvecteur * pvarval2) return true if var1 is bef...
static void remove_blanks(char **ps)
static float parse_coeff(char **ps)
char * monome_sprint(Pmonome pm, Pbase pb, bool plus_sign, char *(*variable_name)(Variable))
char monome_sprint(Pmonome pm, Pbase pb, bool plus_sign, char (*variable_name)()) PRIVATE Outputs a s...
void polynome_fprint(FILE *fd, Ppolynome pp, char *(*variable_name)(Variable), int *is_inferior_var)
void polynome_fprint(FILE* fd, Ppolynome pp, char* (*variable_name)(), bool (*is_inferior_var)()) Out...
int default_is_inferior_varval(Pvecteur varval1, Pvecteur varval2)
bool default_is_inferior_varval(Pvecteur varval1, Pvecteur varval2) return true if var1 is before var...
static char * parse_var_name(char **ps)
Ppolynome polynome_sscanf(char *sp, Variable(*name_to_variable)(Variable))
Ppolynome polynome_sscanf(char *sp, (*name_to_variable)()) converts into polynomial structure the exp...
#define POLYNOME_BUFFER_SIZE
int default_is_inferior_var(Variable var1, Variable var2)
bool default_is_inferior_var(Variable var1, Variable var2) return true if var1 is before var2,...
char * default_variable_name(Variable var)
char *default_variable_name(Variable var) returns for variable var the name "Vxxxx" where xxxx are fo...
char * polynome_sprint(Ppolynome pp, char *(*variable_name)(Variable), int *is_inferior_var)
char polynome_sprint(Ppolynome pp, char (*variable_name)(), bool (*is_inferior_var)()) Outputs to fil...
void float_to_frac(float x, char **ps)
void float_to_frac(float x, char** ps) PRIVATE returns the simplest representation of floating-point ...
double intpower(double d, int n)
double intpower(double d, int n) returns d^n for all integers n
Pbase polynome_used_var(Ppolynome pp, int *is_inferior_var)
Pbase polynome_used_var(Ppolynome pp, bool *is_inferior_var()) PRIVATE Returns, in a Pbase,...
Ppolynome polynome_sort(Ppolynome *ppp, int *is_inferior_var)
Ppolynome polynome_sort((Ppolynome *) ppp, bool (*is_inferior_var)()) Sorts the polynomial *ppp: mono...
#define POLYNOME_UNDEFINED_SYMBOL
#define PNOME_FLOAT_TO_EXP_LEVEL
#define MONOME_UNDEFINED_SYMBOL
#define PNOME_FLOAT_TO_FRAC_LEVEL
#define MONOME_NUL_SYMBOL
#define POLYNOME_UNDEFINED_P(pp)
#define MONOME_UNDEFINED_P(pm)
#define polynome_monome(pp)
#define monome_coeff(pm)
Macros definitions.
#define POLYNOME_NUL_P(pp)
#define POLYNOME_NUL_SYMBOL
#define MONOME_VAR_MULTIPLY_SYMBOL
#define polynome_succ(pp)
#define PNOME_FLOAT_N_DECIMALES
#define MONOME_COEFF_MULTIPLY_SYMBOL
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * variable_name(Variable v)
polynome_ri.c
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...