Пример #1
0
int fiv(int n) {
  int a;
  int b;
  int i;

  /*この時点の様子1*/
  /* for(i=3;i>=n;i--){
    if(i==3)printf("[");
    printf("{n=%d, a=?, b=?}",i);
    if(i!=n){
      printf(", ");
    }else{
      printf("]\n");
    }
    }*/
    
  printf("{n=%d, a=?, b=?}\n",n);
  if (n <= 1) {
    return v[n];
  } else {
    a = fiv(n - 1);
    /*この時点の様子2*/
    printf("{n=%d, a=%d, b=?}\n",n,a);
    b = fiv(n - 2);
    /*この時点の様子3*/
    printf("{n=%d, a=%d, b=%d}\n",n,a,b);
    return a + b;
  }
}
Пример #2
0
    // Range Test
    TEST_P(YalaaEleFunctionTest, RangeTest)
    {
      while(!m_x.empty()) {
        test_iv_t x1(m_x.front());
	iv_t x(x1.m_x);
        iv_t fiv((*m_meta.ivf)(x));
        AFF_TYPE faff((*m_meta.afff)(AFF_TYPE(x)));
        iv_t faffiv (to_iv(faff));
        ASSERT_TRUE(iv_traits::my_inf(faffiv) <= iv_traits::my_sup(fiv) &&
                    iv_traits::my_sup(faffiv) >= iv_traits::my_inf(fiv))
          << "Interval and affine evaluation do not intersect!" << std::endl
          << "Input was " << x << " fiv: " << fiv << " faff " << faff << std::endl;

	// ASSERT_TRUE(iv_traits::my_inf(faffiv) <= iv_traits::my_inf(x1.m_r) &&
	// 	    iv_traits::my_sup(faffiv) >= iv_traits::my_sup(x1.m_r))
	//   << "Inclusion iso violated!"
	//   << "Input was " << x << " old: " << x1.m_r << " faff " << faff << std::endl;

        // ASSERT_LE(iv_traits::my_inf(faffiv), iv_traits::my_inf(fiv))
        //    << "Affine evaluation was tigher than IV for a single elementary function."
        //    << "Input was " << x << " fiv: " << fiv << " faff " << faff << std::endl;
        // ASSERT_GE(iv_traits::my_sup(faffiv), iv_traits::my_sup(fiv))
        //   << "Affine evaluation was tigher than IV for a single elementary function."
        //   << "Input was " << x << " fiv: " << fiv << " faff " << faff << std::endl;
        if(iv_traits::my_sup(x) - iv_traits::my_inf(x) > S_EPS) {
          base_t mid = (iv_traits::my_inf(x) + iv_traits::my_sup(x))/2;
          m_x.push_back(test_iv_t(iv_t(iv_traits::my_inf(x), mid), faffiv));
          m_x.push_back(test_iv_t(iv_t(mid, iv_traits::my_sup(x)), faffiv));
        }
        m_x.pop_front();
      }
    }
Пример #3
0
void SongSettingWidget::on_toolButtonBrowseBackround2_clicked()
{
    QString filename;
    if (mySettings2.backgroundType == 0)
    {
        QColor c(QColorDialog::getColor(mySettings2.backgroundColor,this));
        if(c.isValid())
        {
            mySettings2.backgroundColor = c;
            mySettings2.isChangedBackColor = true;
        }
        QPalette p;
        p.setColor(QPalette::Base,mySettings2.backgroundColor);
        ui->graphicsViewBackgroundColor2->setPalette(p);
    }
    else if (mySettings2.backgroundType == 1)
    {
        filename = QFileDialog::getOpenFileName(this, tr("Select a image for Bible wallpaper"),
                                                ".", tr("Images(%1)").arg(getSupportedImageFormats()));
        if(!filename.isNull())
        {
            QPixmap pix(filename);
            if(pix.width()>1280 || pix.height()>1280)
                mySettings2.backgroundPix = pix.scaled(1280,1280,Qt::KeepAspectRatio);
            else
                mySettings2.backgroundPix = pix;
            QFileInfo fip(filename);
            filename = fip.fileName();
            mySettings2.backgroundName = filename;
            ui->lineEditBackPath2->setText(filename);
            mySettings2.isChangedBackPix = true;
        }
    }
    else if (mySettings2.backgroundType == 2)
    {
        filename = QFileDialog::getOpenFileName(this, tr("Select a video for Bible wallpaper"),
                                                ".", "*");
        if(!filename.isNull())
        {
            mySettings2.backgroundVideoPath = filename;
            QFileInfo fiv(filename);
            filename = fiv.fileName();

            ui->lineEditBackPath2->setText(filename);
            mySettings2.isChangedBackVid = true;
        }
    }
}
Пример #4
0
    // Pown Range Test
   TEST(POWN, RangeTest)
    {
      typedef yalaa::details::double_iv_t iv_t;
      typedef yalaa::details::base_traits<iv_t> iv_traits;
      typedef double base_t;
      std::deque<iv_t> m_x;
      for(int exp = -10; exp <= 10; exp++) {
        m_x.clear();
        if(exp < 0)
          m_x.push_back(iv_t(0.1, 10));
        else
          m_x.push_back(iv_t(-10, 10));
        while(!m_x.empty()) {
          iv_t x(m_x.front());
          iv_t fiv(iv_traits::my_pow(x, exp));
          AFF_TYPE aarg(x);
          AFF_TYPE faff(pown(aarg, exp));
          iv_t faffiv (to_iv(faff));
          iv_t isect(intersect(faffiv, fiv));
          if(!exp)
            ASSERT_EQ(faffiv, iv_traits::my_one())
              << "pown(x,0) does not yield iv_traits::my_one()"
              << "Input was " << x << "^" << exp << " fiv: " << fiv << " faff " << faff << std::endl;
          else if(exp == 1)
            ASSERT_EQ(faff, aarg)
              << "pown(x,1) does not preserve identity of x!"
              << "Input was " << x << "^" << exp << " fiv: " << fiv << " faff " << faff << std::endl;

          ASSERT_TRUE(iv_traits::my_inf(faffiv) <= iv_traits::my_sup(fiv) &&
                      iv_traits::my_sup(faffiv) >= iv_traits::my_inf(fiv))
            << "Interval and affine evaluation do not intersect!" << std::endl
            << "Input was " << x << "^" << exp << " fiv: " << fiv << " faff " << faff << std::endl;
          // ASSERT_LE(iv_traits::my_inf(faffiv), iv_traits::my_inf(fiv))
          //    << "Affine evaluation was tigher than IV for a single elementary function."
          //    << "Input was " << x << " fiv: " << fiv << " faff " << faff << std::endl;
          // ASSERT_GE(iv_traits::my_sup(faffiv), iv_traits::my_sup(fiv))
          //   << "Affine evaluation was tigher than IV for a single elementary function."
          //   << "Input was " << x << " fiv: " << fiv << " faff " << faff << std::endl;
          if(iv_traits::my_sup(x) - iv_traits::my_inf(x) > 0.0001) {
            base_t mid = (iv_traits::my_inf(x) + iv_traits::my_sup(x))/2;
            m_x.push_back(iv_t(iv_traits::my_inf(x), mid));
            m_x.push_back(iv_t(mid, iv_traits::my_sup(x)));
          }
          m_x.pop_front();
        }
      }
    }
Пример #5
0
int main(void){
  int ans,n;
  fiv(3);
  return 0;
}