Beispiel #1
0
static NUMH(jtnumj){C*t,*ta;D x,y;Z*v;
 v=(Z*)vv;
 if(t=memchr(s,'j',n))ta=0; else t=ta=memchr(s,'a',n);
 RZ(numd(t?t-s:n,s,&x));
 if(t){t+=ta?2:1; RZ(numd(n+s-t,t,&y));} else y=0;
 if(ta){C c;
  c=*(1+ta);
  RZ(0<=x&&(c=='d'||c=='r'));
  if(c=='d')y*=PI/180; if(y<=-P2||P2<=y)y-=P2*jfloor(y/P2); if(0>y)y+=P2;
  v->re=y==0.5*PI||y==1.5*PI?0:x*cos(y); v->im=y==PI?0:x*sin(y);
 }else{v->re=x; v->im=y;}
 R 1;
}
Beispiel #2
0
/**
 * Converts a number into a string equivalent.
 *
 * @param	num		The number to convert
 * @return			The string representation of the number.
 */
char *numtos(int num){
	int len = numd(num);
	char *number = (char *) malloc(len);
	while(len){
		number[len-1] = dtoc(num % 10);
		num /= 10;
		len--;
	}
	return number;
}