GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/math/details/pio_2_splitting.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 4 4 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //======================================================================================================================
2 /*
3 POLYFLOAT - Extended precision floating points
4 Copyright : POLYFLOAT Contributors & Maintainers
5 SPDX-License-Identifier: BSL-1.0
6 */
7 //======================================================================================================================
8 #pragma once
9
10 namespace plf::_
11 {
12 1120 template<typename T> constexpr auto pio_2_splitting(as<T> const&) noexcept
13 {
14 using u_t = eve::underlying_type_t<T>;
15 // using e_t = eve::element_type_t<T>;
16 if constexpr (dimension_v<T> == 1)
17 {
18 if constexpr (std::same_as<u_t, float>)
19 {
20 // cody waite constants for:
21 // number of constants : 24
22 // total number of significand bit : 3
23 // The constant definition : 1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242834617301743052271633241066968036301245706368
24 // boundary for trailing zero bit number : 8
25 // logarithm of max input for required precision : 5.996890
26 return kumi::tuple{float(0x1.9200000000000p+0), float(0x1.f000000000000p-12), float(0x1.6a88860000000p-17)};
27 }
28 else if constexpr (std::same_as<u_t, double>)
29 {
30 // cody waite constants for:
31 // number of constants : 53
32 // total number of significand bit : 3
33 // The constant definition : 1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242834617301743052271633241066968036301245706368
34 // boundary for trailing zero bit number : 18
35 // logarithm of max input for required precision : 12.928362
36 return kumi::tuple{double(0x1.921f800000000p+0), double(0x1.aa22000000000p-19), double(0x1.68c234c4c6629p-39)};
37 }
38 }
39 else if constexpr (dimension_v<T> == 2)
40 {
41 if constexpr (std::same_as<u_t, float>)
42 {
43 // cody waite constants for:
44 // number of constants : 48
45 // total number of significand bit : 3
46 // The constant definition : 1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242834617301743052271633241066968036301245706368
47 // boundary for trailing zero bit number : 24
48 // logarithm of max input for required precision : 17.087245
49
50 126 return kumi::tuple{from_pair<float>(0x1.9210000000000p+0, 0x0.0p+0),
51 126 from_pair<float>(0x1.f6a0000000000p-13, 0x0.0p+0),
52 126 from_pair<float>(0x1.110b460000000p-26, 0x1.1a62640000000p-54)};
53 }
54 else if constexpr (std::same_as<u_t, double>)
55 {
56 // cody waite constants for:
57 // number of constants : 106
58 // total number of significand bit : 3
59 // The constant definition : 1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242834617301743052271633241066968036301245706368
60 // boundary for trailing zero bit number : 53
61 // logarithm of max input for required precision : 37.188513
62 204 return kumi::tuple{from_pair<double>(0x1.921fb54000000p+0, 0x0.0p+0),
63 204 from_pair<double>(0x1.10b4600000000p-30, 0x0.0p+0),
64 204 from_pair<double>(0x1.1a62633145c07p-54, -0x1.f1976b7ed8fbcp-110)};
65 }
66 }
67 else if constexpr (dimension_v<T> == 3)
68 {
69 if constexpr (std::same_as<u_t, float>)
70 {
71 // cody waite constants for:
72 // number of constants : 72
73 // total number of significand bit : 3
74 // The constant definition : 1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242834617301743052271633241066968036301245706368
75 // boundary for trailing zero bit number : 18
76 // logarithm of max input for required precision : 12.928362
77 390 return kumi::tuple{from_triple<float>(0x1.921fb60000000p+0, -0x1.8000000000000p-25, 0x0.0p+0),
78 390 from_triple<float>(0x1.10b4600000000p-30, 0x1.0000000000000p-54, 0x0.0p+0),
79 390 from_triple<float>(0x1.a626340000000p-58, -0x1.d747f20000000p-83, -0x1.f1976c0000000p-110)};
80 }
81 else if constexpr (std::same_as<u_t, double>)
82 {
83 // cody waite constants for:
84 // number of constants : 169
85 // total number of significand bit : 3
86 // The constant definition : 1.5707963267948966192313216916397514420985846996875529104874722961539082031431044993140174126710585339910740432566411533235469223047752911158626797040642405587251420513509692605527798223114744774651909822144054878329667230642378241168933915826356009545728242834617301743052271633241066968036301245706368
87 // boundary for trailing zero bit number : 24
88 // logarithm of max input for required precision : 17.087245
89 return kumi::tuple{
90 400 from_triple<double>(0x1.921fb54442d18p+0, 0x1.1a62400000000p-54, 0x0.0p+0),
91 400 from_triple<double>(0x1.198a2e0370734p-73, 0x1.2902000000000p-127, 0x0.0p+0),
92 400 from_triple<double>(0x1.3822299f31d01p-145, -0x1.f44159c4ec64ep-199, 0x1.28a5043cc71a0p-254)};
93 }
94 }
95 }
96 }
97