Example #1
0
ssize_t 
sqrtFloat(ssize_t d, ssize_t s) 
{ 
  get_d(d) = sqrt(get_d(s)); 
  set_dtag(d);
  return d;
}
Example #2
0
ssize_t 
acosFloat (ssize_t d, ssize_t s) 
{
  get_d (d) = acos (get_d (s));
  set_dtag(d);
  return d;
}
Example #3
0
ssize_t 
divFloat(ssize_t d, ssize_t x, ssize_t y) 
{
  get_d(d) = get_d(x) / get_d(y);
  set_dtag(d);
  return d;
}
Example #4
0
ssize_t 
lnFloat(ssize_t d, ssize_t s) 
{
  get_d(d) = log(get_d(s));
  set_dtag(d);
  return d;
}
Example #5
0
ssize_t 
atan2Float (ssize_t d, ssize_t y, ssize_t x) 
{
  get_d (d) = atan2 (get_d (y), get_d (x));
  set_dtag(d);
  return d;
}
Example #6
0
ssize_t 
coshFloat(ssize_t d, ssize_t s) 
{
  get_d(d) = cosh(get_d(s));
  set_dtag(d);
  return d;
}
Example #7
0
ssize_t 
tanhFloat(ssize_t d, ssize_t s) 
{
  get_d(d) = tanh(get_d(s));
  set_dtag(d);
  return d;
}
Example #8
0
ssize_t 
asinFloat (ssize_t d, ssize_t s) 
{
  get_d (d) = asin (get_d (s));
  set_dtag(d);
  return d;
}
Example #9
0
ssize_t 
powFloat (ssize_t d, ssize_t x, ssize_t y) 
{
  get_d (d) = pow (get_d (x), get_d (y));
  set_dtag(d);
  return d;
}
Example #10
0
static char char_at(obj* self, va_list* args) {
	int i = va_arg(*args, int);

	if (i < 0) {
		LOG_CRITICAL("Attempt to access index %d of string with length %d", i, get_d(self, "length"));
		abort();
	} else if (i >= get_d(self, "length")) {
		LOG_CRITICAL("Attempt to access index %d of string with length %d", i, get_d(self, "length"));
		abort();
	}

	return get_s(self, "value")[i];
}
Example #11
0
ssize_t 
ceilFloat(ssize_t f) 
{ 
  double arg;
  ssize_t i;

  arg = get_d(f);

  if( arg >= 0.0 ) 
    { 
      if( arg > Max_Int_d ) goto raise_ceil;
      i = (ssize_t) arg;
      if( arg > ((double) i) ) i += 1;
    }
  else 
    { 
      if( arg <= (Min_Int_d - 1.0) ) goto raise_ceil;
      i = (ssize_t) arg;
    }
  return convertIntToML(i);

 raise_ceil:
  raise_exn((uintptr_t)&exn_OVERFLOW);
  return 0;                          // never reached
}
Example #12
0
ssize_t 
floorFloat(ssize_t f) 
{ 
  double r;
  ssize_t i;

  r = get_d(f);
  if( r >= 0.0 ) 
    { 
      if ( r >= (Max_Int_d + 1.0) ) 
	{
	  raise_exn((uintptr_t)&exn_OVERFLOW);
	}
      return (convertIntToML((ssize_t) r));
    }
  if( r < Min_Int_d ) 
    {
      raise_exn((uintptr_t)&exn_OVERFLOW);
    }
  i = (ssize_t) r;
  if( r < ((double) i) ) 
    {
      i -= 1;
    }
  return convertIntToML(i);
}
Example #13
0
  /* ************************************************************************* */
  VectorValues GaussianConditional::solve(const VectorValues& x) const
  {
    // Concatenate all vector values that correspond to parent variables
    const Vector xS = x.vector(FastVector<Key>(beginParents(), endParents()));

    // Update right-hand-side
    const Vector rhs = get_d() - get_S() * xS;

    // Solve matrix
    const Vector solution = get_R().triangularView<Eigen::Upper>().solve(rhs);

    // Check for indeterminant solution
    if (solution.hasNaN()) {
      throw IndeterminantLinearSystemException(keys().front());
    }

    // Insert solution into a VectorValues
    VectorValues result;
    DenseIndex vectorPosition = 0;
    for (const_iterator frontal = beginFrontals(); frontal != endFrontals(); ++frontal) {
      result.insert(*frontal, solution.segment(vectorPosition, getDim(frontal)));
      vectorPosition += getDim(frontal);
    }

    return result;
  }
Example #14
0
ssize_t 
posInfFloat(ssize_t d) 
{
  get_d(d) = HUGE_VAL;
  set_dtag(d);
  return d;
}
Example #15
0
ssize_t 
negInfFloat(ssize_t d) 
{
  get_d(d) = -HUGE_VAL;
  set_dtag(d);
  return d;
}
Example #16
0
ssize_t 
isnanFloat(ssize_t s) 
{
  if (isnan(get_d(s))) 
    {
      return mlTRUE;
    }
  return mlFALSE;
}
Example #17
0
ssize_t 
realInt(ssize_t d, ssize_t x) 
{
  debug(printf("[realInt: d = %zu, x = %zu\n", d, x));
  get_d(d) = (double) (convertIntToC(x));
  set_dtag(d);
  debug(printf("]\n"));
  return d;
}
Example #18
0
void LineShape2D::draw(const RID &p_to_rid, const Color &p_color) {

	Vector2 point = get_d() * get_normal();

	Vector2 l1[2] = { point - get_normal().tangent() * 100, point + get_normal().tangent() * 100 };
	VS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, 3);
	Vector2 l2[2] = { point, point + get_normal() * 30 };
	VS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, 3);
}
Example #19
0
size_t 
sml_bytes_to_real(size_t d, String s)
{
  double r;
  char* a = &(s->data);
  r = ((double*)a)[0];
  get_d(d) = r;
  set_dtag(d);
  return d;
}
Example #20
0
// return shift-register in shortend form as json string
String Flippie::shift_register_as_json() {
  char *r = (char *)malloc(1024);
  unsigned char r_len =
      sprintf(r, "{\n\t\"address\": %i,\n\t\"column\": %i,\n\t\"row_set\": "
                 "%i,\n\t\"row_rst\": %i,\n\t\"led_A\": %u,\n\t\"led_B\": "
                 "%u,\n\t\"led_C\": %u,\n\t\"d\": %u\n}\n\0",
              get_address(), get_column(), get_row_set(), get_row_rst(),
              led_A_on ? 1 : 0, led_B_on ? 1 : 0, led_C_on ? 1 : 0, get_d());
  String s(r);
  free(r);
  return s;
}
Example #21
0
float PID::get_pid(float targetInput, float actualInput, float dt)
{
if (_active == DISABLED)
	return 0;

_error = targetInput - actualInput;
_p = get_p(_error);
_i = get_i(_error, dt);
_d = get_d(actualInput, dt);

return _p + _i + _d;			//, -_outLimit._value, _outLimit._value);
}
Example #22
0
String
REG_POLY_FUN_HDR(sml_real_to_bytes, Region rAddr, size_t f)
{
  size_t i;
  double a[1];
  char v[sizeof(double) + 1];
  a[0] = get_d(f);
  for (i = 0; i < sizeof(double) ; i++)
    v[i] = ((char*)a)[i];
  v[sizeof(double)] = 0;
  return REG_POLY_CALL(convertBinStringToML, rAddr, 8, v);
}
Example #23
0
ssize_t 
truncFloat(ssize_t f) 
{ 
  double r;

  r = get_d(f);
  if ((r >= (Max_Int_d + 1.0)) || (r <= (Min_Int_d - 1.0))) 
    { 
      raise_exn((uintptr_t)&exn_OVERFLOW);
    }
  return convertIntToML((ssize_t)r);
}
Example #24
0
String
REG_POLY_FUN_HDR(stringOfFloat, Region rAddr, size_t arg) 
{
  char buf[64];
  sprintf(buf, "%.12g", get_d(arg));
  mkSMLMinus(buf);
  if( countChar('.', buf) == 0 && countChar('E', buf) == 0 ) 
    {
      strcat(buf, ".0");
    }
  return REG_POLY_CALL(convertStringToML, rAddr,buf);
}
Example #25
0
int main()
{
     char c = getchar();int x = get_d();
     a.mark = c;
     printf("%c %d\n",a.mark,a.num);
     b.mark = a.mark;
     printf("%c %d\n",b.mark,b.num);
     a.num = x;
     printf("%c %d\n",a.mark,a.num);
     b.num=a.num;
     printf("%c %d\n",b.mark,b.num);
     return 0;
}
Example #26
0
void cai_tien()
{
    get_t();
    do
    {
        get_cd_ct();
        get_c();
        if (Tong > 5000) meo_vat();
        get_d();
        updatekt();
        mumu();
    } while (!Kt);
}
Example #27
0
Vector& Vector::operator=(const Vector_exact& vec)
{
   assert(dim() == vec.dim());

   for( int i = 0; i < dim(); i++ )
   {
      val[i] = get_d(vec[i]);
   }

   assert(isConsistent());

   return *this;
}
Example #28
0
Rect2 LineShape2D::get_rect() const {

	Vector2 point = get_d() * get_normal();

	Vector2 l1[2] = { point - get_normal().tangent() * 100, point + get_normal().tangent() * 100 };
	Vector2 l2[2] = { point, point + get_normal() * 30 };
	Rect2 rect;
	rect.pos = l1[0];
	rect.expand_to(l1[1]);
	rect.expand_to(l2[0]);
	rect.expand_to(l2[1]);
	return rect;
}
Example #29
0
String
REG_POLY_FUN_HDR(generalStringOfFloat, Region rAddr, String format, size_t f) 
{
  char result_buf[512];

  /* Unfortunately there seems to be no way to ensure that this does not
   * crash by overflowing the result_buffer (e.g. when specifying a huge 
   * number of decimal digits in the fixed-point format): 
   */
  sprintf(result_buf, &(format->data), get_d(f));
  mkSMLMinus(result_buf);
  return REG_POLY_CALL(convertStringToML, rAddr, result_buf);
}
Example #30
0
/* this performs the discrete transform */
CVC_trans discrete_transform(CVC *YPbPr) 
{
        CVC_trans pack_to_return;

        pack_to_return.Pb = YPbPr->avg_Pb;
        pack_to_return.Pr = YPbPr->avg_Pr;
        pack_to_return.a = get_a(YPbPr);
        pack_to_return.b = get_b(YPbPr);
        pack_to_return.c = get_c(YPbPr);
        pack_to_return.d = get_d(YPbPr);

        return pack_to_return;
}