Skip to content

Commit 580767b

Browse files
committed
Add changes for 0d407dd
1 parent e708935 commit 580767b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+751
-582
lines changed

_sources/guides/accuracy.md.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ kf::vec<float, 4> c = kf::fast_rcp(x);
2525
kf::vec<float, 4> d = kf::fast_div(a, b);
2626
```
2727

28-
These functions are only functional for 32-bit and 16-bit floats.
28+
These functions are only functional for 32-bit and 16-bit floats.
2929
For other input types, the operation falls back to the regular version.
3030

3131
## Approximate Math
3232

33-
For 16-bit floats, several approximate functions are provided.
34-
These use approximations (typically low-degree polynomials) to calculate rough estimates of the functions.
33+
For 16-bit floats, several approximate functions are provided.
34+
These use approximations (typically low-degree polynomials) to calculate rough estimates of the functions.
3535
This can be very fast but also less accurate.
3636

3737

@@ -69,14 +69,15 @@ kf::vec<half, 4> a = kf::approx_sin<3>(x);
6969

7070
## Tuning Accuracy Level
7171

72-
Many functions in Kernel Float accept an additional Accuracy option as a template parameter.
72+
Many functions in Kernel Float accept an additional `Accuracy` option as a template parameter.
7373
This allows you to tune the accuracy level without changing the function name.
7474

75-
There are four possible values for this parameter:
75+
There are five possible values for this parameter:
7676

7777
- `kf::accurate_policy`: Use the most accurate version of the function available.
7878
- `kf::fast_policy`: Use the "fast math" version.
79-
- `kf::approx_policy<N>`: Use the approximate version with degree `N`.
79+
- `kf::approx_level_policy<N>`: Use the approximate version with accuracy level `N` (higher is more accurate).
80+
- `kf::approx_policy`: Use the approximate version with a default accuracy level.
8081
- `kf::default_policy`: Use a global default policy (see the next section).
8182

8283
For example, consider this code:
@@ -97,15 +98,19 @@ kf::vec<float, 2> c = kf::cos<kf::accurate_policy>(input);
9798
kf::vec<float, 2> d = kf::cos<kf::fast_policy>(input);
9899

99100
// Use the approximate policy
100-
kf::vec<float, 2> e = kf::cos<kf::approx_policy<3>>(input);
101+
kf::vec<float, 2> e = kf::cos<kf::approx_policy>(input);
102+
103+
// Use the approximate policy with degree 3 polynomial.
104+
kf::vec<float, 2> f = kf::cos<kf::approx_level_policy<3>>(input);
101105

102106
// You can use aliases to define your own policy
103107
using my_own_policy = kf::fast_policy;
104-
kf::vec<float, 2> f = kf::cos<my_own_policy>(input);
108+
kf::vec<float, 2> g = kf::cos<my_own_policy>(input);
105109
```
106110

107111
## Setting `default_policy`
108112

113+
If no policy is explicitly set, any function use the `kf::default_policy`.
109114
By default, `kf::default_policy` is set to `kf::accurate_policy`.
110115

111116
Set the preprocessor option `KERNEL_FLOAT_FAST_MATH=1` to change the default policy to `kf::fast_policy`.

_static/css/badge_only.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_static/css/theme.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_static/fonts/Lato/lato-bold.eot

250 KB
Binary file not shown.

_static/fonts/Lato/lato-bold.ttf

587 KB
Binary file not shown.

_static/fonts/Lato/lato-bold.woff

302 KB
Binary file not shown.

_static/fonts/Lato/lato-bold.woff2

181 KB
Binary file not shown.
260 KB
Binary file not shown.
608 KB
Binary file not shown.
316 KB
Binary file not shown.

0 commit comments

Comments
 (0)