|
RT-AICHIP-sample
|

マクロ定義 | |
| #define | INVSQRT_NEWTON_METHOD_NUM (2) |
関数 | |
| float | tInvSqrt (float x) |
| float | tSqrt (float x) |
| void | quickSort (int numbers[], int left, int right) |
| #define INVSQRT_NEWTON_METHOD_NUM (2) |
tinyMathFunctions.c の 12 行目に定義があります。
| void quickSort | ( | int | numbers[], |
| int | left, | ||
| int | right | ||
| ) |
クイックソートの実装
| numbers[] | 配列 |
| left | クイックソートする区間の左端 |
| right | クイックソートする区間の右端 |
tinyMathFunctions.c の 79 行目に定義があります。

| float tInvSqrt | ( | float | x | ) |
高速なinvSqrt(x)の実装.
ニュートン法を一回実行するごとにfloatの乗算が3回必要
INVSQRT_NEWTON_METHOD_NUMでニュートン法の適用回数を決める
math.hのsqrt()に対して
0:誤差は ±0.05以下
1:誤差は ±0.005以下
2:誤差は ±0.000005以下
3:誤差は ほぼなし
| x | 定義域は[-1.0,1.0] |
tinyMathFunctions.c の 26 行目に定義があります。
| float tSqrt | ( | float | x | ) |
高速なsqrt(x)の実装.
invSqrt(x)*xでsqrt(x)を計算
invSqrt(x)のニュートン法ステップ3回でほぼ誤差なしになる.
| x | 定義域は[-1.0,1.0] |
tinyMathFunctions.c の 47 行目に定義があります。
