Exemple #1
0
void *ST_dtime(void)
{
  double dt;
  dt = dtime();
  Tset((ATerm)ATmakeReal(dt));
  return NULL;
}
Exemple #2
0
ATerm STR_REALS_ceil(ATerm t)
{
  double r;

  if(ATgetType(t) != AT_REAL && ATgetType(t) != AT_INT)
    return NULL;
  NUMERIC_ATERM_TO_REAL(r, t);
  return (ATerm) ATmakeReal(ceil(r));
}
Exemple #3
0
void *_div(void)
{ int k, l;
  double r1, r2;
  int res = number_pair(&k, &l, &r1, &r2);

  if(res == 0) return fail_address;
  else if(res == 1)
    {
      if(k % l == 0)
	{ Tset((ATerm) ATmakeInt(k / l)); }
      else
	{ Tset((ATerm) ATmakeReal((double)k / (double)l)); }
    }
  else 
    {
      Tset((ATerm) ATmakeReal(r1 / r2));	
    }
  return NULL;
}
Exemple #4
0
void *_min(void)
{ int k, l;
  double r1, r2;
  int res = number_pair(&k, &l, &r1, &r2);

  if(res == 0) return fail_address;
  else if(res == 1)
    { Tset((ATerm) ATmakeInt(k <= l ? k : l)); }
  else 
    { Tset((ATerm) ATmakeReal(r1 <= r2 ? r1 : r2)); }
  return NULL;
}
Exemple #5
0
void *_plus(void)
{ int k, l;
  double r1, r2;
  int res = number_pair(&k, &l, &r1, &r2);

  if(res == 0) return fail_address;
  else if(res == 1)
    {
      Tset((ATerm) ATmakeInt(k + l));	
    }
  else 
    {
      Tset((ATerm) ATmakeReal(r1 + r2));	
    }
  return NULL;
}
Exemple #6
0
void *_sin(void)
{ int k;
  double r; 
  if(ATmatch(Ttop(), "<int>", &k))
    {
      r = (double)k;
    } 
  else if(ATmatch(Ttop(), "<real>", &r))
    {
      ;
    } 
  else 
    return fail_address; 

  Tset((ATerm) ATmakeReal(sin(r)));
  return NULL;
}
Exemple #7
0
ATerm SSL_modr(ATerm x, ATerm y)
{ 
  assert_is_real(x);
  assert_is_real(y);
  return((ATerm) ATmakeReal(fmod(_get_real(x), _get_real(y))));
}
Exemple #8
0
ATerm SSL_divr(ATerm x, ATerm y)
{ 
  assert_is_real(x); 
  assert_is_real(y);
  return((ATerm) ATmakeReal(_get_real(x) / _get_real(y)));
}