DStr& DStr::operator+=(const DStr& other) { if (!other.text_) return *this; nadd(other.text_, other.byteLength_); DynBlockItem *b; for (b = other.blocks.first; b; b = b -> next) nadd(b -> data, b -> byteCount); return *this; }
double newton(int N, double *Nt, double *x, double *y){ int i; double iks[N]; for(i = 0; i < N; i++){ Nt[i] = 0; iks[i] = 0; } iks[0] = 1; Nt[0] = y[0]; double ai; for(i = 1; i < N; i++){ int j; for(j = N-1; j > 0; j--){ iks[j] += iks[j-1]; iks[j-1] *= -x[i-1]; } ai = (y[i] - Polynomial(N, Nt, x[i]))/(Polynomial(N, iks, x[i])); // printf("ai: %f, y[i] = %f, rmian = %f, Licznik = %f\n", ai, y[i], Polynomial(N, Nt, x[i]), Polynomial(N, iks, x[i])); // for(j = 0; j < N; j++){ // printf("j: %i, iks: %f, Nt: %f \n", j, iks[j], Nt[j]); // } nadd(N, Nt, iks, ai); } // int j; // for(j = 0; j < N; j++){ // printf("j: %i, iks: %f, Nt: %f \n", j, iks[j], Nt[j]); // } return 0; }
DStr& DStr::operator+= (const Str& addingStr) { nadd((char*) addingStr, addingStr.length()); return *this; }
DStr& DStr::operator+= (const char *adding) { if (!text_ || *adding) nadd(adding, strlen(adding)); return *this; }