#ifndef _QUAD_H
#define _QUAD_H

typedef struct quad_type {
  double a;
  double b;
  double c;
  double dis;
} quad_type;

#define HAS_MAX(q)      (!((q)->a >= 0.0))
#define HAS_MIN(q)      (!((q)->a <= 0.0))
#define HAS_EXTREME(q)  (HAS_MAX(q) || HAS_MIN(q))
#define HAS_ROOTS(q)    ((q)->dis>=0.0) 
#define IN_RANGE(a,b,c) ((a<=b)&&(b<=c))

void
quad_set 	(quad_type * q,
		 double x_1, double y_1,
		 double x_2, double y_2,
		 double x_3, double y_3);

quad_type *
quad_create 	(void);

double
quad_y		(quad_type * q, double x);

#ifdef ALL 
int
quad_solve 	(quad_type * q, double *x_1, double *x_2);

int
quad_extreme 	(quad_type * q, double *xe);
#endif
#endif