// (3)The exact solution of f(x) = ax^3 + bx^2 + cx + d
double IntePolyExact(double a, double b, double c, double d, double A, double B){
    double value;
    
    value = a/4.0*(mypow(B,4)-mypow(A,4)) + b/3.0*(mypow(B,3)-mypow(A,3)) + c/2.0*(mypow(B,2)-mypow(A,2))+ d*(B-A);
    
    return value;
}
Esempio n. 2
0
void TaoArithNode::numberArith()
{
	if(oper==TAO_PLUS)
		myValue = left->myValue + right->myValue;
	else if(oper==TAO_MINUS)
		myValue = left->myValue - right->myValue;
	else if(oper==TAO_TIMES)
		myValue = left->myValue  * right->myValue;
	else if(oper==TAO_DIVIDE)
		myValue = left->myValue / right->myValue;
	else if(oper==TAO_MOD)
		myValue=(int)left->myValue%(int)right->myValue;
	else if(oper==TAO_POW)
		myValue=mypow(left->myValue,right->myValue);
	else if(oper==TAO_AND)
		myValue = left->myValue && right->myValue;
	else if(oper==TAO_OR)
		myValue = left->myValue || right->myValue;
	else if(oper==TAO_EQUAL)
		myValue = left->myValue == right->myValue;
	else if(oper==TAO_SMALLER)
		myValue = left->myValue < right->myValue;
	else if(oper==TAO_LARGER)
		myValue = left->myValue > right->myValue;
	else if(oper==TAO_NOT_EQUAL)
		myValue = left->myValue != right->myValue;
	else if(oper==TAO_NOT_LARGER)
		myValue = left->myValue <= right->myValue;
	else if(oper==TAO_NOT_SMALLER)
		myValue = left->myValue >= right->myValue;
	else{
		short rtti=-1;
		if( left->interResult ) rtti=left->interResult->rtti();
		if( rtti==TAO_Number ){
			TaoNumber *num=(TaoNumber*)left->interResult;
			if( oper==TAO_ASSIGN_PLUS ){
				num->value += right->myValue;
			}else if( oper==TAO_ASSIGN_MINUS ){
				num->value -= right->myValue;
			}else if( oper==TAO_ASSIGN_TIMES ){
				num->value *= right->myValue;
			}else if( oper==TAO_ASSIGN_DIVIDE ){
				num->value /= right->myValue;
			}else if( oper==TAO_ASSIGN_MOD ){
				num->value = (int)num->value % (int)right->myValue;
			}else if( oper==TAO_ASSIGN_POW ){
				num->value = mypow( num->value, right->myValue );
			}else if( oper==TAO_ASSIGN_AND ){
				num->value = num->value && right->myValue;
			}else if( oper==TAO_ASSIGN_OR ){
				num->value = num->value || right->myValue;
			}
		}
	}
}
Esempio n. 3
0
int mypow(int a, int n)
{
	int r;
	if(n == 1)
		return a;
	if(n % 2 == 0) {
		r = mypow(a, n/2);
		return r * r;
	} else {
		r = mypow(a, n/2);
		return r * r * a;
	}
}
Esempio n. 4
0
 int integerBreak(int n) {
     int res=0;
     int resTemp=0;
     int first,firstNum,second,secondNum;
     for(int i=2;i<=n;i++){
         first=n/i;
         secondNum=n%i;
         second=first+1;
         firstNum=i-secondNum;
         resTemp=mypow(first,firstNum)*mypow(second,secondNum);
         res=max(res,resTemp);
     }
     return res;
 }
Esempio n. 5
0
int stringtoint(char s[]){
	int len = strlen(s);
	int digit, num, sign;
	num = 0;
	sign = 1;
	
	int pos = 0;
	int curr_digit = 0;
	while (pos < len){
			
		if (s[len-pos-1] != '-'){
			/*
			printf("s: %c\n", s[len-pos-1]);
			printf("s int: %i\n", (int)(s[len-pos-1]));
			printf("pos: %i\n", pos);
			printf("len: %i\n", len);
			*/
			digit = (int)(s[len - pos -1]) - 48;//reverse order
			num += mypow(10, curr_digit) * digit;
			/*
			printf("DIGIT: %i\n", digit);
			printf("\n");
			*/
			curr_digit += 1;
			pos += 1;
		}
		else {
			sign = -1;
			pos += 1;
		}
	}
	return num * sign;
}
Esempio n. 6
0
/*功能判断i是否在自己set中,
 * 采用安位与的方法
 * 返回一表示存在,返回0表示不存在
 */
int inSet(int i, int set)
{
	if( (mypow(2,i-1)&set)>0)
		return 1;
	else
		return 0;
}
Esempio n. 7
0
//显示一个数字
//x,y:起点坐标
//num:数值(0~65536); 
void TFT_ShowNum(u8 x,u16 y,long num)
{      
	u32 res ;   	   
	u8 t=0,t1=0;

	if(num == 0)
	{ 
	 TFT_ShowChar(x,y,'0');
	}
	if(num < 0) 
	{
	 num = -num;
	 TFT_ShowChar(x,y,'-');	
	 x += 6;
	}
	res = num; 
	while(res)  
	{
		res/=10;
		t++;
	}
	t1=t;
	while(t)	
	{
		res = mypow(10,t-1); 
	    TFT_ShowChar(x+(t1-t)*6,y,(num/res)%10+'0');
		t--;
	}	     
} 
Esempio n. 8
0
int main()
{
	int a, n;
	scanf("%d %d", &a, &n);
	printf("%d^%d=%d\n", a, n, mypow(a, n));
	return 0;
}
Esempio n. 9
0
int main(int argc, char const *argv[])
{
	printf("输入两个数求次方:\n");
	int m,n;
	scanf("%d,%d",&m,&n);
	printf("%d的%d次方是:%d\n",m,n,mypow(m,n));
	return 0;
}
Esempio n. 10
0
int main (){
   
   int result = mypow(3,5);
   printf("%d \n", result);


return EXIT_SUCCESS;
}
Esempio n. 11
0
/*功能是从集合中删除元素i
 * 将set中的第i位设置成0,表示从集合s中删除了
 */
int deleteSet(int i, int set)
{
	if(inSet(i,set))
	{
		set = ~(mypow(2,i-1))&set;
	}
	return set;
}
Esempio n. 12
0
// 递归函数
int mypow(int m,int n)
{	
	if (n == 1)
	{
		return m;
	}

	return m * mypow(m,n-1); 
}
Esempio n. 13
0
// n < 4,759,123,141        3 :  2, 7, 61
// n < 1,122,004,669,633    4 :  2, 13, 23, 1662803
// n < 3,474,749,660,383          6 :  pirmes <= 13
// n < 2^64                       7 :
// 2, 325, 9375, 28178, 450775, 9780504, 1795265022
// Make sure testing integer is in range [2, n−2] if
// you want to use magic.
bool witness(LL a,LL n,LL u,int t){
	LL x=mypow(a,u,n);
	for(int i=0;i<t;i++) {
		LL nx=mul(x,x,n);
		if(nx==1&&x!=1&&x!=n-1) return 1;
		x=nx;
	}
	return x!=1;
}
Esempio n. 14
0
int main()
{
	int i,n;
	f[2]=1;f[3]=5; 
	for(i=4;i<100;i++)
		f[i]=(i-1)*mypow(i-2)+f[i-1];
	while(scanf("%d",&n)!=EOF)
		printf("%I64d\n",f[n]); 
return 0;
}
Esempio n. 15
0
File: pow.c Progetto: rowanpang/test
/*递归不是目的,目的是节约时间*/
int mypow(int x,int n)
{
    if(n ==0){
	return 1;
    }

    if(n == 1){
        return x;
    }
    return x*mypow(x,n-1);
}
Esempio n. 16
0
int main()
{
	ll T;
	scanf("%lld",&T);
	while(T--)
	{
		ll a,b;
		scanf("%lld%lld",&a,&b);
		ll res=mypow(a,b);
		printf("result is:=%lld\n",res);
	}
	return 0;
}
int main() {
    int n, m, tmp, i;
    while(scanf("%d %d", &n, &m) == 2) {
        if(n == 1)  printf("%d\n", 14%m);
        else if(n == 2)  printf("%d\n", 155%m);
        else if(n == 3)  printf("%d\n", 1575%m);
        else {
            tmp = 1575%m;
            tmp = tmp*mypow(10, n-3, m)%m;
            printf("%d\n", tmp);
        }
    }
    return 0;
}
Esempio n. 18
0
void* calloc(size_t size, size_t nb)
{
  void* ptr = malloc(size * nb);

  if (ptr)
  {
    size_t ssize = mypow(2, (((header*) ((char*) ptr - 8))->size)) - 7;
    ssize /= 8;

    for (size_t i; i < ssize; i++)
      ((size_t*) ptr)[i] = 0;
  }

  return ptr;
}
Esempio n. 19
0
File: pow.c Progetto: rowanpang/test
int main() {
    int t,n;
    long ret,ret2,ret3;
    scanf("%d",&t);
    scanf("%d",&n);

    printf("%d^%d\n",t,n);

    ret = mypow(t,n);
    ret2 = mypow2(t,n);
    ret3 = power(t,n);
    printf("ret:%ld,%#lx\n",ret,ret);
    printf("ret2:%ld,%#lx\n",ret2,ret2);
    printf("ret3:%ld,%#lx\n",ret3,ret3);
    return 0;
}
Esempio n. 20
0
void lcd1602_num(u8 X,u8 Y,u32 num,u16 len)
{
  u8 s,i;
  u8 temp;
  u8 test;
  
  s=len;
  
  for(i=0;i<s;i++)
  {
    test=mypow(10,s-i-1);
    temp = (num/test)%10;
    lcd1602_one_char(X+i,Y,Num[temp]);
  }
  
  
  
  
}
Esempio n. 21
0
    bool isHappy(int n) {
        int sum = n;
        set<int> sumsRecord;

        while (sum != 1) {
            int sumTmp = 0;
            while (sum > 0) {
                sumTmp += mypow(sum % 10);
                sum /= 10;
            }
            sum = sumTmp;
            if (sumsRecord.count(sum) != 0)
                return false;
            else
                sumsRecord.insert(sum);
        }

        return true;
    }
Esempio n. 22
0
//显示2个数字
//x,y :起点坐标	 
//len :数字的位数
//size:字体大小
//mode:模式	0,填充模式;1,叠加模式
//num:数值(0~4294967295);	 		  
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size)
{         	
	u8 t,temp;
	u8 enshow=0;						   
	for(t=0;t<len;t++)
	{
		temp=(num/mypow(10,len-t-1))%10;
		if(enshow==0&&t<(len-1))
		{
			if(temp==0)
			{
				OLED_ShowChar(x+(size/2)*t,y,' ',size,1);
				continue;
			}else enshow=1; 
		 	 
		}
	 	OLED_ShowChar(x+(size/2)*t,y,temp+'0',size,1); 
	}
} 
Esempio n. 23
0
//display a number
//x,y :address	 
//num:value(0~4294967295);
//len :length of the number
//size:size of the font	 		  
void OLED_ShowNum(uint8_t x,uint8_t y,uint32_t num,uint8_t len,uint8_t size)
{         	 
	uint8_t t,temp;
	uint8_t enshow=0;						   
	for(t=0;t<len;t++)
	{
		temp=(num/mypow(10,len-t-1))%10;
		if(enshow==0&&t<(len-1))
		{
			if(temp==0)
			{
				OLED_ShowChar(x+8*t,y,' ',size,1);
				continue;
			}else enshow=1; 
		 	 
		}
	 	OLED_ShowChar(x+8*t,y,temp+'0',size,1); 
	}
}
Esempio n. 24
0
/* 运算时  数据栈出栈两次   操作符栈出栈一次 
 * 运算完之后的结果压栈
 * */
static int do_operate(struct calc *calc)
{
	num_t a, b;
	char c;

	if (NUM_POP(b) < 0) {
		fprintf(stderr,"Error: num pop failed.\n");
		return -1;
	}
	if (NUM_POP(a) < 0) {
		fprintf(stderr,"Error: num pop failed.\n");
		return -1;
	}
	if (OPR_POP(c) < 0) {
		fprintf(stderr,"Error: opr pop failed.\n");
		return -2;
	}

	num_t res = 0;
	float chuchu = 0;
	switch(c) {
		case '+': res = a + b; break;
		case '-': res = a - b; break;
		case '*': res = a * b; break;
		case '/': res = a / b; break;
		case '%': res = a % b; break;
		case '^': res = mypow(a,b); break; 
		case '#': chuchu = (float)a / (float)b;NUM_PUSH(chuchu);printf("kfkdf %f\n", chuchu);return 0;
		default : break;
	}

#ifdef _DEBUG
	printf("DEBUG %d %c %d = %d\n",a, c, b, res);
#endif
	NUM_PUSH(res);

	return 0;
}
Esempio n. 25
0
void lcd_display_number(unsigned int x,
                        unsigned int y,
                        unsigned long num,
                        unsigned char num_len )
{
        unsigned char t,temp;
        unsigned char enshow=0;          // ´Ë±äÁ¿ÓÃÀ´È¥µô×î¸ßλµÄ0

        for(t=0;t<num_len;t++)
        {
                temp=(num/mypow(10,num_len-t-1))%10;
                if(enshow==0&&t<(num_len-1))
                {
                        if(temp==0)
                        {
                                DisplayChar(' ',x+t,y);
                                continue;
                        }else enshow=1;

                }
                DisplayChar(temp+'0',x+t,y);
        }
}
Esempio n. 26
0
int main(void)
{
#if 0
	char pre_seq[] = "4213657";
	char in_seq[]  = "1234567";

	root = init(pre_seq, in_seq, 7);
#endif

#if 0
	char pre_seq[] = "421356";
	char in_seq[]  = "123456";

	root = init(pre_seq, in_seq, 6);
#endif

#if 0
	link a, b, c;
	link d, e, f;

//	printf("demo binary tree!\n");
	a = make_node('4');
	b = make_node('2');
	c = make_node('5');

	d = make_node('1');
	e = make_node('3');
	f = make_node('6');

	a->l = b;
	a->r = c;
	b->l = d;
	//b->r = e;
	//c->r = f;
	d->r = f;
	f->r = e;

	root = a;
#endif

extern yyin;
	yyin = stdin;

	while (1)
	{
		yylex();
		continue;
		char ch;

		ch = getchar();
		getchar();
		if (ch == 'q')
			break;
		root = insert(root, ch);
		
		printf("\t\\tree ");
		traverse(root);
		printf("\n\n");
		fflush(stdout);
	}

	while (1)
	{
		char ch = getchar();
		getchar();

		link p = search(root, ch);
		if (p != NULL)
			printf("%c is found\n", ch);
		else
			printf("%c is NOT found\n", ch);
	}

	printf("count = %d\n", count(root));
	printf("depth = %d\n", depth(root));
	printf("balance = %d\n", isbalanced(root));

	if (mypow(2, depth(root)) == count(root) + 1)
		printf("it is a FULL Btree\n");
	else
		printf("it is not a FULL Btree\n");


	return 0;
}
Esempio n. 27
0
bool check(ll res,ll p){
    for(int i=0;i<divi.size();i++)
        if(mypow(res,(p-1)/divi[i],p)==1) return 0;
    return 1;
}
Esempio n. 28
0
int main(void) {

    int f,i,j,k,c,x,y,ix,iy,displayloop;
    int usingmap,makingmap,mmx,mmy,tmpmap,maploop;
    float rx,ry,nrx,nry,px,py;
    RGB rgb;
    FILE *fp;

    img=(uchar **)calloc(scrhei,sizeof(uchar *));
    for (y=0; y<scrhei; y++) {
        img[y]=(uchar *)calloc(scrwid,sizeof(uchar));
        for (x=0; x<scrwid; x++) {
            img[y][x]=myrnd()*255;
        }
    }
    img2=(uchar **)calloc(scrhei,sizeof(uchar *));
    for (y=0; y<scrhei; y++) {
        img2[y]=(uchar *)calloc(scrwid,sizeof(uchar));
        for (x=0; x<scrwid; x++) {
            img2[y][x]=myrnd()*255;
        }
    }

    srand((int)time(NULL));

    usingmap=0;
    makingmap=1;
    mmx=0;
    mmy=0;

    /* Originals from QB
    op[0] = 1; damp[0] = .999; force[0] = .005;
    op[1] = 1.02; damp[1] = .999; force[1] = .002;
    op[2] = 0; damp[2] = .999; force[2] = .002;
    op[3] = 1; damp[3] = .999; force[3] = .005;
    op[4] = 1; damp[4] = .999; force[4] = .005;
    op[5] = 0; damp[5] = .999; force[5] = .002;
    */

// 0 Accelerate
    op[0] = 1;
    damp[0] = .999;
    force[0] = .005;
// 1 Velocity
    op[1] = 1.02;
    damp[1] = .999;
    force[1] = .01;
// 2 Rotation
    op[2] = 0;
    damp[2] = .999;
    force[2] = .05;
// 3 Drip
    op[3] = 1;
    damp[3] = .999;
    force[3] = .03;
// 4 Dribble
    op[4] = 1;
    damp[4] = .999;
    force[4] = .01;
// 5 Slide
    op[5] = 0;
    damp[5] = .999;
    force[5] = .01;

    for (f=0; f<fs; f++) {
        var[f] = op[f];
        fon[f]=1;
    }

    allegro_init ();
    install_keyboard ();
    install_timer ();
    set_gfx_mode (GFX_AUTODETECT, scrwid, scrhei, 0, 0);
    set_pallete (desktop_palette);
    _farsetsel(screen->seg);
    for (c=0; c<=255; c++) {
        rgb.r=saw(0,c);
        rgb.g=saw(256/3,c);
        rgb.b=saw(2*256/3,c);
        set_color(c,&rgb);
    }

    while(!key[KEY_ESC]) {

        // Generate some more of the map
        for (maploop=1; maploop<scrwid*scrhei/15; maploop++) {
            rx=(float)mmx/scrwid*2-1;
            ry=(float)(mmy-scrhei/2)/scrwid*2;
            if (fon[1]) {
                rx = rx / var[1];
                ry = ry / var[1];
            }
            if (fon[0]) {
                rx = mysgn(rx)/var[1]*mypow(myabs(rx),1/var[6]);
                ry = mysgn(ry)/var[1]*mypow(myabs(ry),1/var[6]);
            }
            if (fon[2]) {
                nrx = rx * cos(var[2]) + ry * sin(var[2]);
                nry = -rx * sin(var[2]) + ry * cos(var[2]);
                rx = nrx;
                ry=nry;
            }
            if (fon[3]) {
                ry = ry / var[3];
            }
            if (fon[4]) {
                ry = ((myabs(ry) - 1) / var[4] + 1) * mysgn(ry);
            }
            if (fon[5]) {
                rx = rx + var[5] * mysgn(rx);
            }
            px=(rx+1)/2*scrwid;
            py=scrhei/2+(ry)/2*scrwid;
            ix=(int)px;
            iy=(int)py;
            amount[mmx][mmy][0][0][makingmap]=((float)ix+1-(float)px)*((float)(iy+1)-(float)py);
            amount[mmx][mmy][1][0][makingmap]=((float)px-(float)ix)*((float)(iy+1)-(float)py);
            amount[mmx][mmy][0][1][makingmap]=((float)ix+1-(float)px)*((float)py-(float)iy);
            amount[mmx][mmy][1][1][makingmap]=((float)px-(float)ix)*((float)py-(float)iy);
            pix[mmx][mmy][makingmap]=ix;
            piy[mmx][mmy][makingmap]=iy;
            if (ix<0 || ix>=scrwid-1 || iy<0 || iy>=scrhei-1) {
                pix[mmx][mmy][makingmap]=scrwid/2;
                piy[mmx][mmy][makingmap]=scrhei/2;
                for (i=0; i<=1; i++) {
                    for (j=0; j<=1; j++) {
                        amount[mmx][mmy][i][j][makingmap]=0;
                    }
                }
            }
            mmx++;
            if (mmx>=scrwid) {
                mmx=0;
                mmy++;
                if (mmy>=scrhei) {
                    mmy=0;
                    tmpmap=usingmap;
                    usingmap=makingmap;
                    makingmap=tmpmap;
                    for (f=0; f<fs; f++) {
                        perturb(f);
                    }
                    for (i=0; i<4; i++) {
                        f = myrnd() * fs;
                        if (myrnd()<.8) {
                            if (myrnd()<.5)
                                fon[f] = 1;
                            else
                                fon[f]=0;
                        }
                    }
                }
            }
        }

        // Animate
        for (x=0; x<scrwid; x++) {
            for (y=0; y<scrhei; y++) {
                c=0;
                for (i=0; i<=1; i++) {
                    for (j=0; j<=1; j++) {
                        c=c+amount[x][y][i][j][usingmap]*img[piy[x][y][usingmap]+j][pix[x][y][usingmap]+i];
                    }
                }
                c--;
                img2[y][x]=c;
            }
        }
        /*        for (y=0;y<scrhei;y++) {
                for (x=0;x<scrwid;x++) {
                  _farpokeb(screen->seg, (unsigned long)screen->line[y]+x, img2[y][x]);
                }
                }*/
        for (y=0; y<scrhei; y++) {
            movedata(_my_ds(), img2[y], screen->seg, bmp_write_line(screen,y), scrwid);
        }
        for (f=0; f<fs; f++) {
            if (fon[f]) {
                hline(screen, scrwid/2, f*2, scrwid/2+(var[f] - op[f]) * scrwid * 4, 0);
            }
        }
        imgtmp=img;
        img=img2;
        img2=imgtmp;
        for (i=1; i<=5; i++) {
            mycircle(myrnd()*scrwid,myrnd()*scrhei,2+myrnd()*8,myrnd()*255);
        }
    }

}
Esempio n. 29
0
int main(void)
{
//	char pre_seq[] = "421356";
//	char in_seq[] = "123456";

//	root = init(pre_seq, in_seq, 6);

#if 0
	link a, b, c, d, e, f;

//	printf("demo binary tree!\n");	
	a = make_node('4');
	b = make_node('2');
	c = make_node('5');
	d = make_node('1');
	e = make_node('3');
	f = make_node('6');

	a->l = b;
//	a->r = c;
	b->l = d;
	d->l = c;
	c->l = f;
	b->r = e;
//	c->r = f;

	root = a;
#endif

	while (1) {
		char ch;
		ch = getchar();
		getchar();	
		if (ch == 'q')
			break;

		root = insert(root, ch);	

		printf("\\tree");
		traverse(root);
		printf("\n");
	}

	while (1) {
		char ch = getchar();
		getchar();

	link p = search(root, ch);
	if (p != NULL)
		printf("%c is found\n", ch);
	else
		printf("%c is NOT found\n", ch);
	}

		printf("count = %d\n", count(root));		
		printf("depth = %d\n", depth(root));		
		printf("balanced = %d\n", isbalanced(root));		
#if 0
	if (mypow(2, depth(root)) == count(root) + 1)
		printf("it is a FULL Btree\n");
	else
		printf("it is not a FULL Btree\n");
#endif

	return 0;
}
Esempio n. 30
0
void moremap() {
    float rx,ry,nrx,nry,px,py;
    int f,i,j,k,c,x,y,ix,iy,displayloop;
    // Generate some more of the map
    for (maploop=1; maploop<scrwid*scrhei/20; maploop++) {
        rx=(float)mmx/scrwid*2-1;
        ry=(float)(mmy-scrhei/2)/scrwid*2;

        /* From QB later
           SUB move (x, y)
           IF fon%(1) THEN
           x = x * var(1): y = y * var(1)
           END IF
           IF fon%(6) THEN
           x = var(1) * SGN(x) * ABS(x) ^ var(6)
           y = var(1) * SGN(y) * ABS(y) ^ var(6)
           END IF
           IF fon%(2) THEN
           nx = x * COS(var(2)) + y * SIN(var(2))
           ny = -x * SIN(var(2)) + y * COS(var(2))
           x = nx
           y = ny
           END IF
           IF fon%(3) THEN
           'y = y - .01 * (y - 1)
           'y = 1 + .99 * (y - 1)
           'y = (y + 1) * .7 - 1
           y = y * var(3)
           END IF
           IF fon%(4) THEN
           y = (y - 1) * var(4) + 1
           END IF
           IF fon%(5) THEN
           x = x + var(5) * x
           END IF
           IF fon%(7) THEN
           IF fon%(10) THEN
           IF fon%(9) THEN
           x = x + var(7) * (-1 + 2 * (p% MOD 2))
           ELSE
           x = x + var(7) * (-1 + 2 * (p% MOD 50) / 49)
           END IF
           ELSE
           x = x + var(7)
           END IF
           END IF
           IF fon%(8) THEN
           IF fon%(10) THEN
           IF fon%(9) THEN
           y = y + var(8) * (-1 + 2 * (p% MOD 2))
           ELSE
           y = y + var(8) * (-1 + 2 * (p% MOD 50) / 49)
           END IF
           ELSE
           y = y + var(8)
           END IF
           END IF
           END SUB
        */

        if (fon[0]) {
            rx = mysgn(rx)/var[7]*mypow(myabs(rx),1/var[0]);
            ry = mysgn(ry)/var[7]*mypow(myabs(ry),1/var[0]);
        }
        if (fon[1]) {
            rx = rx / var[1];
            ry = ry / var[1];
        }
        if (fon[2]) {
            nrx = rx * cos(var[2]) + ry * sin(var[2]);
            nry = -rx * sin(var[2]) + ry * cos(var[2]);
            rx = nrx;
            ry=nry;
        }
        if (fon[3]) {
            ry = ry - mysgn(ry) * sin(var[6]*pi*myabs(ry)) * var[3];
        }
        if (fon[4]) {
            ry = ((myabs(ry) - 1) / var[4] + 1) * mysgn(ry);
        }
        if (fon[5]) {
            rx = rx - mysgn(rx) * sin(var[6]*pi*myabs(rx)) * var[5];
        }
        px=(rx+1)/2*scrwid;
        py=scrhei/2+(ry)/2*scrwid;
        ix=(int)px;
        iy=(int)py;
        if (ix<0 || ix>=scrwid-1 || iy<0 || iy>=scrhei-1) {
            ix=px;
            iy=py;
        }
        amount[mmx][mmy][0][0][makingmap]=((float)ix+1-(float)px)*((float)(iy+1)-(float)py);
        amount[mmx][mmy][1][0][makingmap]=((float)px-(float)ix)*((float)(iy+1)-(float)py);
        amount[mmx][mmy][0][1][makingmap]=((float)ix+1-(float)px)*((float)py-(float)iy);
        amount[mmx][mmy][1][1][makingmap]=((float)px-(float)ix)*((float)py-(float)iy);
        pix[mmx][mmy][makingmap]=ix;
        piy[mmx][mmy][makingmap]=iy;
        if (ix<0 || ix>=scrwid-1 || iy<0 || iy>=scrhei-1) {
            pix[mmx][mmy][makingmap]=scrwid/2;
            piy[mmx][mmy][makingmap]=scrhei/2;
            for (i=0; i<=1; i++) {
                for (j=0; j<=1; j++) {
                    amount[mmx][mmy][i][j][makingmap]=0;
                }
            }
        }
        mmx++;
        if (mmx>=scrwid) {
            mmx=0;
            mmy++;
            if (mmy>=scrhei) {
                mmy=0;
                tmpmap=usingmap;
                usingmap=makingmap;
                makingmap=tmpmap;
                for (f=0; f<fs; f++) {
                    perturb(f);
                }
            }
        }
    }
}