libfxd 0.2.dev
A fixed-point library for C++.
Loading...
Searching...
No Matches
numbers.cpp
#include <iomanip>
#include <iostream>
#include <limits>
#include <numbers>
#include <fxd/fxd.hpp>
template<fxd::fixed_point Fxd>
void
print(const char* name,
Fxd val)
{
std::cout << std::setw(10)
<< name
<< " = "
<< val << '\n';
}
template<fxd::fixed_point Fxd>
void
report_all()
{
std::cout << "std::numbers::\n";
std::cout.precision(std::numeric_limits<Fxd>::digits10);
print("egamma", std::numbers::egamma_v<Fxd>);
print("inv_pi", std::numbers::inv_pi_v<Fxd>);
print("inv_sqrt3", std::numbers::inv_sqrt3_v<Fxd>);
print("inv_sqrtpi", std::numbers::inv_sqrtpi_v<Fxd>);
print("ln10", std::numbers::ln10_v<Fxd>);
print("ln2", std::numbers::ln2_v<Fxd>);
print("log10e", std::numbers::log10e_v<Fxd>);
print("log2e", std::numbers::log2e_v<Fxd>);
print("phi", std::numbers::phi_v<Fxd>);
print("sqrt2", std::numbers::sqrt2_v<Fxd>);
print("sqrt3", std::numbers::sqrt3_v<Fxd>);
}
int main()
{
report_all<fxd::fixed<8, 24>>();
}
Includes all of libfxd headers.
const Fxd inv_sqrt3_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:40
const Fxd log2e_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:55
const Fxd phi_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:58
const Fxd e_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:31
const Fxd log10e_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:52
const Fxd sqrt3_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:67
const Fxd sqrt2_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:64
const Fxd ln10_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:46
const Fxd pi_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:61
const Fxd ln2_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:49
const Fxd egamma_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:34
const Fxd inv_pi_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:37
const Fxd inv_sqrtpi_v< Fxd >
Fixed-point constant for .
Definition: numbers.hpp:43