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

📄 ancap1.lst

📁 Embedded camera control program.
💻 LST
📖 第 1 页 / 共 5 页
字号:
.................... // Description : returns the arcsine value of the value x.  
.................... // Date : N/A  
.................... //  
.................... float asin(float x)  
.................... {  
....................    float r;  
....................   
....................    r = ASIN_COS(x, 0);  
....................    return(r);  
.................... }  
....................   
....................   
.................... ////////////////////////////////////////////////////////////////////////////  
.................... //	float acos(float x)  
.................... ////////////////////////////////////////////////////////////////////////////  
.................... // Description : returns the arccosine value of the value x.  
.................... // Date : N/A  
.................... //  
.................... float acos(float x)  
.................... {  
....................    float r;  
....................   
....................    r = ASIN_COS(x, 1);  
....................    return(r);  
.................... }  
....................   
.................... float const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457};  
.................... float const qat[4] = {1.0000000,  11.368190, 28.982246, 19.818457};  
....................   
.................... ////////////////////////////////////////////////////////////////////////////  
.................... //	float atan(float x)  
.................... ////////////////////////////////////////////////////////////////////////////  
.................... // Description : returns the arctangent value of the value x.  
.................... // Date : N/A  
.................... //  
.................... float atan(float x)  
.................... {  
....................    float y, res, r;  
....................    int1 s, flag;  
....................   
....................    s = 0;  
....................    flag = 0;  
....................    y = x;  
....................   
....................    if (x < 0)  
....................    {  
....................       s = 1;  
....................       y = -y;  
....................    }  
....................   
....................    if (y > 1.0)  
....................    {  
....................       y = 1.0/y;  
....................       flag = 1;  
....................    }  
....................   
....................    res = pat[0]*y*y + pat[1];  
....................    res = res*y*y + pat[2];  
....................    res = res*y*y + pat[3];  
....................   
....................    r = qat[0]*y*y + qat[1];  
....................    r = r*y*y + qat[2];  
....................    r = r*y*y + qat[3];  
....................   
....................    res = y*res/r;  
....................   
....................   
....................    if (flag)                              // for |x| > 1  
....................       res = PI_DIV_BY_TWO - res;  
....................    if (s)  
....................       res = -res;  
....................   
....................    return(res);  
.................... }  
....................   
.................... /////////////////////////////////////////////////////////////////////////////  
.................... //	float atan2(float y, float x)  
.................... /////////////////////////////////////////////////////////////////////////////  
.................... // Description :computes the principal value of arc tangent of y/x, using the  
.................... // signs of both the arguments to determine the quadrant of the return value  
.................... // Returns : returns the arc tangent of y/x.  
.................... // Date : N/A  
.................... //  
....................   
....................   
.................... float atan2(float y,float x)  
.................... {  
....................    float z;  
....................    int1 sign;  
....................    int quad;  
....................    sign=0;  
....................    quad=0; //quadrant  
....................    quad=((y<=0.0)?(x<=0.0)?:4):((x<0.0)?:1));  
....................    if(y<0.0)  
....................    {  
....................       sign=1;  
....................       y=-y;  
....................    }  
....................    if(x<0.0)  
....................    {  
....................       x=-x;  
....................    }  
....................    if (x==0.0)  
....................    {  
....................       if(y==0.0)  
....................       {  
....................       #ifdef _ERRNO  
....................       {  
....................          errno=EDOM;  
....................       }  
....................       #endif  
....................       }  
....................       else  
....................       {  
....................          if(sign)  
....................          {  
....................          return (-(PI_DIV_BY_TWO));  
....................          }  
....................          else  
....................          {  
....................          return (PI_DIV_BY_TWO);  
....................          }  
....................       }  
....................    }  
....................    else  
....................    {  
....................       z=y/x;  
....................       switch(quad)  
....................       {  
....................          case 1:  
....................          {  
....................             return atan(z);  
....................             break;  
....................          }  
....................          case 2:  
....................          {  
.................... //            return (atan(z)+PI_DIV_BY_TWO);  //2L3122  
....................             return (PI-atan(z));  
....................             break;  
....................          }  
....................          case 3:  
....................          {  
....................             return (atan(z)-PI);  
....................             break;  
....................          }  
....................          case 4:  
....................          {  
....................             return (-atan(z));  
....................             break;  
....................          }  
....................       }  
....................    }  
.................... }  
....................   
.................... //////////////////// Hyperbolic functions ////////////////////  
....................   
.................... ////////////////////////////////////////////////////////////////////////////  
.................... //	float cosh(float x)  
.................... ////////////////////////////////////////////////////////////////////////////  
.................... // Description : Computes the hyperbolic cosine value of x  
.................... // Returns : returns the hyperbolic cosine value of x  
.................... // Date : N/A  
.................... //  
....................   
.................... float cosh(float x)  
.................... {  
....................    return ((exp(x)+exp(-x))/2);  
.................... }  
....................   
.................... ////////////////////////////////////////////////////////////////////////////  
.................... //	float sinh(float x)  
.................... ////////////////////////////////////////////////////////////////////////////  
.................... // Description : Computes the hyperbolic sine value of x  
.................... // Returns : returns the hyperbolic sine value of x  
.................... // Date : N/A  
.................... //  
....................   
.................... float sinh(float x)  
.................... {  
....................   
....................    return ((exp(x) - exp(-x))/2);  
.................... }  
....................   
.................... ////////////////////////////////////////////////////////////////////////////  
.................... //	float tanh(float x)  
.................... ////////////////////////////////////////////////////////////////////////////  
.................... // Description : Computes the hyperbolic tangent value of x  
.................... // Returns : returns the hyperbolic tangent value of x  
.................... // Date : N/A  
.................... //  
....................   
.................... float tanh(float x)  
.................... {  
....................    return(sinh(x)/cosh(x));  
.................... }  
....................   
.................... ////////////////////////////////////////////////////////////////////////////  
.................... //	float frexp(float x, signed int *exp)  
.................... ////////////////////////////////////////////////////////////////////////////  
.................... // Description : breaks a floating point number into a normalized fraction and an integral  
.................... // power of 2. It stores the integer in the signed int object pointed to by exp.  
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval  
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero,  
.................... // both parts of the result are zero.  
.................... // Date : N/A  
.................... //  
....................   
....................   
....................   
.................... #define LOG2 .30102999566398119521  
.................... float frexp(float x, signed int *exp)  
.................... {  
....................    float res;  
....................    int1 sign = 0;  
....................    if(x == 0.0)  
....................    {  
....................       *exp=0;  
....................       return (0.0);  
....................    }  
....................    if(x < 0.0)  
....................    {  
....................      x=-x;  
....................      sign=1;  
....................    }  
....................    if (x > 1.0)  
....................    {  
....................       *exp=(ceil(log10(x)/LOG2));  
....................       res=x/(pow(2, *exp));  
....................       if (res == 1)  
....................       {  
....................          *exp=*exp+1;  
....................           res=.5;  
....................       }  
....................    }  
....................    else  
....................    {  
....................       if(x < 0.5)  
....................       {  
....................          *exp=-1;  
....................          res=x*2;  
....................       }  
....................       else  
....................       {  
....................          *exp=0;  
....................           res=x;  
....................       }  
....................    }  
....................    if(sign)  
....................    {  
....................       res=-res;  
....................    }  
....................    return res;  
.................... }  
....................   
.................... //////////////////////////////////////////////////////////////////////////////  
.................... //	float ldexp(float x, signed int *exp)  
.................... //////////////////////////////////////////////////////////////////////////////  
.................... // Description : multiplies a floating point number by an integral power of 2.  
.................... // Returns : returns the value of x times 2 raised to the power exp.  
.................... // Date : N/A  
.................... //  
....................   
.................... float ldexp(float value, signed int exp)  
.................... {  
....................    return (value * pow(2,exp));  
.................... }  
.................... #endif  
....................  
.................... #include <stdlib.h> 
....................  ///////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
.................... //// This source code may only be used by licensed users of the CCS C  ////  
.................... //// compiler.  This source code may only be distributed to other      ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
.................... //// or distribution is permitted without written permission.          ////  
.................... //// Derivative programs created using this software in object code    ////  
.................... //// form are not restricted in any way.                               ////  
.................... ///////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STDLIB  
.................... #define _STDLIB  
....................   
.................... //---------------------------------------------------------------------------  
.................... // Definitions and types  
.................... //---------------------------------------------------------------------------  
....................   
.................... #ifndef RAND_MAX  
.................... #define RAND_MAX  32767    // The value of which is the maximum value  
....................                            // ... returned by the rand function  
.................... #endif  
....................   
.................... typedef struct {  
....................    signed int quot;  
....................    signed int rem;  
.................... } div_t;  
....................   
.................... typedef struct {  
....................    signed long quot;  
....................    signed long rem;  
.................... } ldiv_t;  
....................   
.................... #include <stddef.h> 
....................  ///////////////////////////////////////////////////////////////////////////  
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
.................... //// This source code may only be used by licensed users of the CCS C  ////  
.................... //// compiler.  This source code may only be distributed to other      ////  
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
.................... //// or distribution is permitted without written permission.          ////  
.................... //// Derivative programs created using this software in object code    ////  
.................... //// form are not restricted in any way.                               ////  
.................... ///////////////////////////////////////////////////////////////////////////  
....................   
.................... #ifndef _STDDEF  
....................   
.................... #define _STDDEF  
....................   

⌨️ 快捷键说明

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