Example #1
0
void distance_between2(float lat1, const float long1, float lat2,
		const float long2, float * distance, float * bearing) {
	//courtesy of http://www.movable-type.co.uk/scripts/latlong.html
	float dLat = radians(lat1 - lat2);
	float dLong = radians(long1 - long2);
	float sindLong = mySin(dLong / 2);
	float sindLat = mySin(dLat / 2);
	lat1 = radians(lat1);
	lat2 = radians(lat2);
	float cosLat1 = myCos(lat1);
	float cosLat2 = myCos(lat2);
	float a = (sindLat * sindLat) + (sindLong * sindLong * cosLat1 * cosLat2);
	float sa = mySqrt(a);
	float c = 2 * fast_atan2f(sa, mySqrt(1 - a));
	*distance = c * 6372.795;
}
Example #2
0
int main()
{
	int n;
	while (~scanf("%d", &n)) {
		int x = mySqrt(n);
		printf("the square root of %d is %d\n", n, x);
	}

	return 0;
}
Example #3
0
File: dcm.c Project: OpenGelo/iarc
void normalize(int * input,int * output, char * negFlag){
	int i;
	uint32_t magnitude = 0;
	int buffer[3] = {0,0,0};

	// Sum the squares of the three input items and take square root.
	for(i = 0; i < 3; i ++){
		
		if(input[i] < 0){
			negFlag[i] = 1;
		}
		else{
			negFlag[i] = 0;
		}
		
		magnitude += input[i] * input[i];
	}
	magnitude = mySqrt(magnitude);
	if(magnitude == 0){
		magnitude = 1;
	}

	// Scale output by ONE/magnitude.
	for(i = 0; i < 3; i ++){
		buffer[i] = ((abs(input[i]) * ONE) / magnitude);
		if(buffer[i] == 0){
			PORTF.OUT = 1;
		}
		
		output[i] = buffer[i];
		
			
		/*	
		if(negFlag[i]){
			output[i] = -output[i];
		}
		*/
	}
}
Example #4
0
void distance_between(float lat1, const float long1, float lat2,
		const float long2, float * distance, int * bearing) {
	//courtesy of http://arduiniana.org/libraries/tinygps/
	float delta = radians(long1 - long2);
	float sdlong = mySin(delta);
	float cdlong = myCos(delta);
	lat1 = radians(lat1);
	lat2 = radians(lat2);
	float slat1 = mySin(lat1);
	float clat1 = myCos(lat1);
	float slat2 = mySin(lat2);
	float clat2 = myCos(lat2);
	delta = (clat1 * slat2) - (slat1 * clat2 * cdlong);
	float x = delta ;
	float y = sdlong * clat2;
	delta = sq(delta);
	delta += sq(clat2 * sdlong);
	delta = mySqrt(delta);
	float denom = (slat1 * slat2) + (clat1 * clat2 * cdlong);
	delta = fast_atan2f(delta, denom);
	*distance =  delta * 6372.795;
	x = (180.0 * (fast_atan2f(y, x)/PI)) ;
	*bearing = ((int) -x + 360)%360 ;
}
Example #5
0
void main(){
  int mySqrt(int x) ;
  int r=mySqrt(36);
  printf("r=%d",r);
}
int mySqrt_exec_(int a) {
	int _result_;
	_result_ = mySqrt(a);
	return _result_;
}
Example #7
0
int main()
{
	int ret = mySqrt(2147395599);
	return 0;
}
Example #8
0
int main(int argc, char *argv[])
{
	int	n = atoi(argv[1]);
	printf("%d\n", mySqrt(n));
	return(0);
}
Example #9
0
int circleYpos(int cXpos, int radius) {
   return mySqrt(radius*radius - cXpos*cXpos);
}