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

📄 logtable.cpp

📁 这是我本人编写的一个32位定点小数运算的函数库。对于没有浮点运算器的场合
💻 CPP
字号:
// LogTable.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <math.h>

#define MAXLOG 32
#define TABLESIZE 46
#define LOGONE (0x80000000u/MAXLOG)

const int ListLen=1024;
main()
{
	for (int i=0;i<ListLen;i++) {
		double x=1.0+(double)i/(double)ListLen,y=log(x);
		long u=(long)(y*LOGONE+0.5);
		printf("%ld, ",u);
		if (i%7==6) printf("\n");
	}
	printf("\n"); printf("\n");

	for (i=-TABLESIZE;i<=TABLESIZE;i++) {
		double x=log(2)*i;
		long u=(long)(x*LOGONE+0.5);
		printf("%ld, ",u);
		if ((i+TABLESIZE)%6==5) printf("\n");
	}
	getch(); return 0;
}

⌨️ 快捷键说明

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