资源简介
查表计算sin值,自己写的小程序,经验证可以精确到小数点后第3位
代码片段和文件信息
#include “stdio.h“
#include “math.h“
float tanArray[89] = {
0.0174551 0.0349208 0.0524078 0.0699268 0.0874887 0.105104 0.122785 0.140541 0.158384 0.176327
0.19438 0.212557 0.230868 0.249328 0.267949 0.286745 0.305731 0.32492 0.344328 0.36397
0.383864 0.404026 0.424475 0.445229 0.466308 0.487733 0.509525 0.531709 0.554309 0.57735
0.600861 0.624869 0.649408 0.674509 0.700208 0.726543 0.753554 0.781286 0.809784 0.8391
0.869287 0.900404 0.932515 0.965689 1 1.03553 1.07237 1.11061 1.15037 1.19175
1.2349 1.27994 1.32704 1.37638 1.42815 1.48256 1.53986 1.60033 1.66428 1.73205
1.80405 1.88073 1.96261 2.0503 2.14451 2.24604 2.35585 2.47509 2.60509 2.74748
2.90421 3.07768 3.27085 3.48741 3.73205 4.01078 4.33148 4.70463 5.14455 5.67128
6.31375 7.11537 8.14434 9.51436 11.43 14.3007 19.0811 28.6362 57.2899
};
unsigned char getangle(double data)
{
unsigned char index = 89;
unsigned char mid = 45;
unsigned char begin = 0;
unsigned char end = 89;
unsigned char right = 0;
if(data>tanArray[88])
{
return 89;
}
if(data {
return 1;
}
while(1)
{
index = ((end - begin)/2)+begin;//第二次循环是23
if(data>tanArray[index])
{
right = 1;
begin = index;
if(data>tanArray[index]&&data {
return (data-tanArray[index])>tanArray[index+1]-data?(index+1):index;
}
}
else
{
right = 0;
end = index;
if(data>tanArray[index-1]&&data {
return (data-tanArray[index-1])>tanArray[index]-data?index:(index-1);
}
}
if(end-begin<1)
{
return (data-tanArray[begin])>tanArray[end]-data?end:begin;
}
}
}
/////找到一个位置,放下这个数,能够让它即大于前面又小于后面
void main()
{
unsigned char data = getangle(0.4);
printf(“%d“data);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15562 2005-04-27 01:30 atan_tab.c
----------- --------- ---------- ----- ----
15562 1
相关资源
- Remote Sensing with Imaging Radar
- Time Frequency Signal Analysis and Processing
- 《数字信号处理基础》 乔伊斯 中文版
- Springer Handbook of Speech Processing
- 爱上processing.pdf
- Digital Signal Processing with Field Programma
- Digital Image Processing (4th Edition)
- Image Processing and Analysis - Stan Birchfie
- Processing语言权威指南中文版1Casey Re
- Time-Frequency Signal Analysis and Processing第
- Optimum Array Processing Part IV of Detection
- SINAMICS S120变频控制系统应用指南
- Digital Image Processing 3th Edition by Gonzal
- DON H.JOHNSON.Array Signal Processing-Concepts
- 数字图像处理(digital image processing)
- 图像处理分析与视觉分析-Image Proces
- SINAMICS S120 变频控制系统应用指南
- Optimum Array Processing 最优阵列处理 (全
- Spotlight Synthetic Aperture Radar Signal Proc
- Digital Signal Processing Principles Algorithm
- 离散时间信号处理Discrete Time Signal P
- Digital Logic Design Using Verilog Coding and
- 环境遥感Remote sensing of the environment
- Digital Logic Design Using Verilog
- Fourier Transform – Signal Processing傅里叶
- railsinstaller3.4.0
- 《Optimum_Array_Processing》,英文版,H
- Deep Learning using Linear Support Vector Mach
- DelphiXE10.3 三方控件集合包EhLib,fast
- Digital Image Processing 4th Edition [Rafael C
评论
共有 条评论