luckfox-pico-sdk/sysdrv/source/mcu/rt-thread/components/benchmark/pi_css5/readme.txt
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

97 lines
2.9 KiB
Plaintext
Executable File

PI(= 3.1415926535897932384626...) Calculation Program
ver. LG1.1.2-MP1.5.2a Nov. 1999
Files:
fftsg_h.c : FFT Package - split-radix - use no work areas
pi_fftcs.c : PI Calculation Program - memory save version
-- use rdft() in "fft*g_h.c"
readme.txt : this file
Makefile : - for gcc modify for your own compiler.
To Compile:
Check macros in "pi_fftcs.c" and modify if necessary.
DBL_ERROR_MARGIN is very impotant parameter.
If DBL_ERROR_MARGIN is very small then efficiency will be bad.
If DBL_ERROR_MARGIN >= 0.5 then it may calculate a wrong result.
Example Compilation:
GNU:
gcc -O -funroll-loops -fomit-frame-pointer pi_fftcs.c fftsg_h.c -lm -o pi_css5
SUN:
cc -fast pi_fftcs.c fftsg_h.c -lm -o pi_css5
HP:
aCC -fast pi_fftcs.c fftsg_h.c -lm -o pi_css5
Microsoft:
cl -O2 pi_fftcs.c fftsg_h.c -o pi_css5
Relationship between Number of Digits and FFT Length:
ndigit = nfft*log_10(R), R >= 10000 or 1000
R is a radix of multiple-precision format.
R depends on DBL_ERROR_MARGIN and
FFT+machine+compiler's tolerance.
Number of Floating Point Operations:
pi_fftcs.c + fftsg_h.c:
42*nfft*(log_2(nfft))^2 [Operations]
Memory Use:
pi_fftcs.c:
nfft*(6*sizeof(short int)+3*sizeof(double)) [Bytes]
AGM Algorithm:
---- a formula based on the AGM (Arithmetic-Geometric Mean) ----
c = sqrt(0.125);
a = 1 + 3 * c;
b = sqrt(a);
e = b - 0.625;
b = 2 * b;
c = e - c;
a = a + e;
npow = 4;
do {
npow = 2 * npow;
e = (a + b) / 2;
b = sqrt(a * b);
e = e - b;
b = 2 * b;
c = c - e;
a = e + b;
} while (e > SQRT_SQRT_EPSILON);
e = e * e / 4;
a = a + b;
pi = (a * a - e - e / 2) / (a * c - e) / npow;
---- modification ----
This is a modified version of Gauss-Legendre formula
(by T.Ooura). It is faster than original version.
Reference:
1. E.Salamin,
Computation of PI Using Arithmetic-Geometric Mean,
Mathematics of Computation, Vol.30 1976.
2. R.P.Brent,
Fast Multiple-Precision Evaluation of Elementary Functions,
J. ACM 23 1976.
3. D.Takahasi, Y.Kanada,
Calculation of PI to 51.5 Billion Decimal Digits on
Distributed Memoriy Parallel Processors,
Transactions of Information Processing Society of Japan,
Vol.39 No.7 1998.
4. T.Ooura,
Improvement of the PI Calculation Algorithm and
Implementation of Fast Multiple-Precision Computation,
Information Processing Society of Japan SIG Notes,
98-HPC-74, 1998.
Copyright
source files:
Copyright(C) 1999 Takuya OOURA
Email: ooura@mmm.t.u-tokyo.ac.jp
URL: http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html
You may use, copy, modify this code for any purpose and
without fee. You may distribute this ORIGINAL package.