int main (int argc, char *argv[]) { long j; tests_start_mpfr (); check (0, MPFR_RNDN); for (j = 0; j < 200000; j++) check (randlimb () & LONG_MAX, RND_RAND ()); check0 (); tests_end_mpfr (); return 0; }
int main (void) { tests_start_mpfr (); check(-1647229822, 40619231, MPFR_RNDZ, "-4.055295438754120596e1"); check(-148939696, 1673285490, MPFR_RNDZ, "-8.9010331404953485501e-2"); check(-441322590, 273662545, MPFR_RNDZ, "-1.6126525096812205362"); check(-1631156895, 1677687197, MPFR_RNDU, "-9.722652100563177191e-1"); check(2141332571, 3117601, MPFR_RNDZ, "6.8685267004982347316e2"); check(75504803, 400207282, MPFR_RNDU, "1.8866424074712365155e-1"); check(643562308, 23100894, MPFR_RNDD, "2.7858762002890447462e1"); check(632549085, 1831935802, MPFR_RNDN, "3.4528998467600230393e-1"); check (1, 1, MPFR_RNDN, "1.0"); check0(); tests_end_mpfr (); return 0; }
void main(void) { mode=0; DDRB=0x00; // все ноги входы PORTB=0xFE; // с подтяжками к питанию MCUCR|=0x03; // прерывание GIMSK=(1<<INT0); // по переднему фронту на INT0 (PB1, SCL) xxx=PINB; while(1) { waiting_for_start: // нажата ли кнопка? if ((PINB&(1<<PB3))==0x00) { __delay_cycles(CLOCK/1000*300); if (mode) mode=0; else mode=1; } if (mode) { if (xxx!=PINB) { if (((PINB&0x03)==0x02)&&(xxx&0x01)) { goto capturing_data; } xxx=PINB; } } goto waiting_for_start; capturing_data: // 1 if (check1()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 1 if (check1()) goto waiting_for_start; // 1 if (check1()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 1 if (check1()) goto waiting_for_start; // 1 if (check1()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // 0 if (check0()) goto waiting_for_start; // перенастраиваем INT0 за задний фронт MCUCR&=~0x03; MCUCR|=0x02; GIFR|=(1<<INTF0); while (!(GIFR&(1<<INTF0))); GIFR|=(1<<INTF0); MCUCR|=0x03; PORTB|=(1<<PB0);DDRB|=(1<<PB0); // 0-1 if (check1()) goto waiting_for_start; // 0-1 if (check1()) goto waiting_for_start; // 0-1 if (check1()) goto waiting_for_start; // 1 if (check1()) goto waiting_for_start; // перенастраиваем INT0 за задний фронт MCUCR&=~0x03; MCUCR|=0x02; // ждем 2 задних фронта GIFR|=(1<<INTF0); while (!(GIFR&(1<<INTF0))); // давим SDA PORTB&=~(1<<PB0);DDRB|=(1<<PB0); // на один такт GIFR|=(1<<INTF0); while (!(GIFR&(1<<INTF0))); GIFR|=(1<<INTF0); MCUCR|=0x03; // отпускаем SDA DDRB&=~(1<<PB0); // идем ждать старта следующей посылки goto waiting_for_start; } }
void func(int i,int D,int L,char* s,char** words) { int count = 0; char ch; int j = 0; int p = 0; int t; while(s[j]!='\0') { ch = s[j]; if(ch == '(') p++; j++; } char* m; char** n; char* y; n = (char**)malloc(L*sizeof(char*)); m = (char*)malloc((L+1)*sizeof(char)); int flag = 0; t = 0; for(t=0;t<L;t++) { n[t] = (char*)malloc((L+1)*sizeof(char)); } t = 0; int k = 0; ch = s[k]; int v = 0; int* x=(int*) malloc(L*sizeof(int)); int z = 0; int gh = 0; int l = 0; printf("p = %d\n",p); switch(p) { case 0: for(t=0;t<L;t++) { m[t] = s[t]; } m[t] = '\0'; check0(&count,D,m,words); break; case 1: printf("INSIDE CASE1\n"); for(z=0;z<L;z++) { *(x+z) = 0; } z =0; k = 0; l=0; ch = s[k]; gh = 0; while(ch != '\0') { printf("s = %s\n",s); printf("ch = %c\n",ch); if(ch == '(') { flag = 0; k++; gh = 0; while(ch != ')' && ch != '\0') { m[gh] = s[k]; k++; ch = s[k]; gh++; } m[gh] = '\0'; printf("m = %s\n",m); gh = 0; while(m[gh]!='\0') { *(*(n+v)+gh) = m[gh]; gh++; } *(*(n+v)+gh) = m[gh]; gh = 0; x[z] = 1; z++; v++; k++; if(ch=='\0') break; } else { t = 0; m[t] = ch; m[t+1] = '\0'; *(*(n+v)+t) = m[t]; *(*(n+v)+(t+1)) = m[t+1]; v++; k++; z++; } ch = s[k]; } v = 0; for(v=0;v<L;v++) { printf("*(n[%d]) = %s\n",v,*(n+v)); } printf("HELOOOOOOO\n"); check(&count,x,D,n,words,L); break; case 2: printf("INSIDE CASE2\n"); for(z=0;z<L;z++) { *(x+z) = 0; } z =0; k = 0; l=0; ch = s[k]; gh = 0; while(ch != '\0') { printf("s = %s\n",s); printf("ch = %c\n",ch); if(ch == '(') { flag = 0; k++; gh = 0; while(ch != ')' && ch != '\0') { m[gh] = s[k]; k++; ch = s[k]; gh++; } m[gh] = '\0'; printf("m = %s\n",m); gh = 0; while(m[gh]!='\0') { *(*(n+v)+gh) = m[gh]; gh++; } *(*(n+v)+gh) = m[gh]; gh = 0; x[z] = 1; z++; v++; k++; if(ch=='\0') break; } else { t = 0; m[t] = ch; m[t+1] = '\0'; *(*(n+v)+t) = m[t]; *(*(n+v)+(t+1)) = m[t+1]; v++; k++; z++; } ch = s[k]; } v = 0; for(v=0;v<L;v++) { printf("*(n[%d]) = %s\n",v,*(n+v)); } check(&count,x,D,n,words,L); break; case 3: printf("INSIDE CASE3\n"); for(z=0;z<L;z++) { *(x+z) = 0; } z =0; k = 0; l=0; ch = s[k]; gh = 0; while(ch != '\0') { if(ch == '(') { flag = 0; k++; gh = 0; while(ch != ')' && ch != '\0') { m[gh] = s[k]; k++; ch = s[k]; gh++; } m[gh] = '\0'; gh = 0; while(m[gh]!='\0') { *(*(n+v)+gh) = m[gh]; gh++; } *(*(n+v)+gh) = m[gh]; gh = 0; x[z] = 1; z++; v++; k++; if(ch=='\0') break; } else { t = 0; m[t] = ch; m[t+1] = '\0'; *(*(n+v)+t) = m[t]; *(*(n+v)+(t+1)) = m[t+1]; v++; k++; z++; } ch = s[k]; } v = 0; for(v=0;v<L;v++) { printf("*(n[%d]) = %s\n",v,*(n+v)); } check(&count,x,D,n,words,L); break; } printf("Case #%d: %d\n",i,count); count = 0; }