⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 r_cosd.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
字号:
#ifndef lintstatic	char sccsid[] = "@(#)r_cosd.c 1.1 92/07/30 SMI";#endif/* * Copyright (c) 1988 by Sun Microsystems, Inc. *//* *  VMS Fortran compatibility function: *  cosine of an angle expressed in degrees. */#include <math.h>static float 	pi_180	= 0.017453292519943295769,r45	= 45.0,r360	= 360.0,r270	= 270.0,r180	= 180.0,r90	= 90.0;FLOATFUNCTIONTYPE r_cosd(x)float *x;{	FLOATFUNCTIONTYPE w;	float y,t;	long ix;	if(!ir_finite_(x))  {t = *x - *x; RETURNFLOAT(t);}	ix   = *((long *)x);	*((long *)&t) = ix&0x7fffffff;		/* t = |*x| */	w = r_fmod_(&t,&r360);	y = *(float*)&w;	ix = 0;	switch ((int)(y/r45)) {	    case 0:   t = pi_180*y;  	   w =  r_cos_(&t); break;	    case 1:	    case 2:   t = pi_180*(r90-y);  w =  r_sin_(&t); break;	    case 3:	    case 4:   t = pi_180*(r180-y); w =  r_cos_(&t); ix = -1; break;	    case 5:   t = pi_180*(y-r270); w =  r_sin_(&t); break;	    case 6:   t = pi_180*(r270-y); w =  r_sin_(&t); ix = -1; break;	    default:  t = pi_180*(y-r360); w =  r_cos_(&t); 	    }	if(ix<0) *(int*)&w ^= 0x80000000;	/* w = -w */	return w;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -