/**
This file is a part of our_dick
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
#ifndef REXY_DETAIL_MATH_HPP
#define REXY_DETAIL_MATH_HPP
namespace math{
namespace detail{
struct zero_initialize_t {};
struct no_initialize_t {};
struct id_initialize_t {};
struct manual_initialize_t {};
}
static inline constexpr detail::zero_initialize_t zero_initialize;
static inline constexpr detail::no_initialize_t no_initialize;
static inline constexpr detail::id_initialize_t id_initialize;
static inline constexpr detail::manual_initialize_t manual_initialize;
template
static constexpr T pi(){
return static_cast(3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821);
}
template
static constexpr T to_degrees(T t){
return (t * 180.0) / pi();
}
template
static constexpr T to_radians(T t){
return (t * pi()) / 180.0;
}
constexpr long double operator"" _rad(long double f){
return f;
}
constexpr long double operator"" _deg(long double f){
return to_radians(f);
}
}
#endif