Open C++ Libraries.org develop
Loading...
Searching...
No Matches
config.hpp
1// SPDX-License-Identifier: BSL-1.0
2// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5// Official repository: https://github.com/open-cpp-libraries/core
6
7#pragma once
8
9#include <boost/math/quaternion.hpp>
10#include <boost/math/special_functions.hpp>
11#include <boost/math/constants/constants.hpp>
12#include <cmath>
13
14#define OCL_MATH_MODULE (202606)
15
16namespace ocl::scientific
17{
18
19 namespace detail
20 {
21
22 inline void throw_math_error(::boost::source_location const& loc = BOOST_CURRENT_LOCATION)
23 {
24 ::boost::throw_exception(std::runtime_error(""), loc);
25 }
26
27 } // namespace detail
28
29 using real_type = double;
30
31 inline const real_type add(const real_type& left, const real_type& right)
32 {
33 return left + right;
34 }
35
36 inline const real_type sub(const real_type& left, const real_type& right)
37 {
38 return left - right;
39 }
40
41 inline const real_type mul(const real_type& left, const real_type& right)
42 {
43 return left * right;
44 }
45
46 inline const real_type div(const real_type& left, const real_type& right)
47 {
48 return left / right;
49 }
50
51 inline const real_type pow(const real_type& left, const real_type& right)
52 {
53 return std::pow(left, right);
54 }
55
56 inline const real_type sqrt(const real_type& left, const real_type& right = 0)
57 {
58 return std::sqrt(left);
59 }
60
61} // namespace ocl