equation.h
来自「circuit calculation program」· C头文件 代码 · 共 40 行
H
40 行
#ifndef __EQUATION_H__
#define __EQUATION_H__
typedef float coef_t;
/* an item in a polynomial */
typedef struct item {
int degree;
coef_t coef;
} item_t;
/* a polynomial */
typedef struct polynomial {
int n_item;
item_t item[1];
} polynomial_t;
polynomial_t * polynomial_mul (polynomial_t *x,polynomial_t *y );
polynomial_t * polynomial_add (polynomial_t *x,polynomial_t *y );
polynomial_t * polynomial_sub (polynomial_t *x,polynomial_t *y );
/* a fraction as coefficient */
typedef struct polynomial_t fraction_t;
#define NUMBERATOR(x) (x)
#define DENOMINATOR(x) ((polynomial_t *)( ((char *)x)+ sizeof( item_t) * x->n_items ))
/* an equation */
typedef struct equation_item {
struct equation_item *next;
int var_index;
fraction_t coef;
} * equation_t;
int add_equation (equation_t equation); /* add a new equation */
#endif /* __EQUATION_H__ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?