/* Copyright (C) 1997, Alexander Pukhov */
#include <stdio.h>
#include <ctype.h>
#include "out_ext.h"

#include "rd_num.h"

int 
rd_num (char *s, double *p)
{
  char varname[10];
  double val;
  int n;

  if (isdigit (*s))
    {
      sscanf (s, "%lf", p);
      return 1;
    }

  for (n = 1; n <= nvar_ + nfunc_; n++)
    {
      vinf_ (n, varname, &val);
      if (strcmp (varname, s) == 0)
	{
	  *p = val;
	  return 1;
	}
    }

  return 0;
}
