Example #1
0
/* Parse a signed number */
int rp_rule_signed_number(rp_parser p, rp_interval i)
{
  int minus = 0;
  rp_interval j;

  /* sign */
  if (rp_parser_accept(p,RP_TOKEN_MINUS))
  {
    minus = 1;
  }
  else if (rp_parser_accept(p,RP_TOKEN_PLUS))
  {
    minus = 0;
  }

  if (rp_rule_unsigned_number(p,j))
  {
    if (minus)
    {
      rp_interval_neg(i,j);
    }
    else
    {
      rp_interval_copy(i,j);
    }
    return( 1 );
  }
  else
  {
    return( 0 );
  }
}
Example #2
0
int rp_operator_newton::compute_negfmid()
{
  for (int i=0; i<_arity; ++i)
  {
    if (!rp_expression_eval(_f[i],_midpoint))
    {
      return( 0 );
    }
    else
    {
      rp_interval_neg(rp_ivector_elem(_negfmid,i),rp_expression_val(_f[i]));
    }
  }
  return( 1 );
}