-
Notifications
You must be signed in to change notification settings - Fork 193
Expand file tree
/
Copy pathchapter12_02-003_zeta_three.cpp
More file actions
36 lines (27 loc) · 1004 Bytes
/
chapter12_02-003_zeta_three.cpp
File metadata and controls
36 lines (27 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2025.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// chapter12_02-003_zeta_three.cpp
#include <concepts>
#include <limits>
#include <iomanip>
#include <iostream>
#include <numbers>
#include <sstream>
template<typename T>
requires std::floating_point<T>
constexpr T zeta_three_v =
T(1.2020569031'5959428539'9738161511'4499907650L);
auto main() -> int;
auto main() -> int
{
std::stringstream strm { };
constexpr float z3_f = zeta_three_v<float>;
constexpr double z3_d = zeta_three_v<double>;
strm << "z3_f: " << std::fixed << std::setprecision(std::numeric_limits<float>::digits10) << z3_f << '\n';
strm << "z3_d: " << std::fixed << std::setprecision(std::numeric_limits<double>::digits10) << z3_d << '\n';
std::cout << strm.str() << std::endl;
}