/* quadtest.c */

#include <hp48/main.h>
#include <hp48/stack.h>
#include <hp48/core.h>
#include <math.h>

int main (int argv, char **argc)
{
  double a, b, c, x1, x2;
  hp_object *r1, *r2;

  c = pop_real();
  b = pop_real();
  a = pop_real();

  x1 = (-b + sqrt(b*b-4*a*c))/(2*a);
  x2 = (-b - sqrt(b*b-4*a*c))/(2*a);

  r1 = sys_malloc (5 + 2 * sizeof (double));
  if (!r1)
    exit(1);
  r2 = sys_malloc (5 + 2 * sizeof (double));
  if (!r2)
    exit(1);

  r1->prolog = 0x2933;
  r1->_hide.real = x1;

  r2->prolog = 0x2933;
  r2->_hide.real = x2;

  push (r1);
  sys_exit(r2);
}



syntax highlighted by Code2HTML, v. 0.9.1