mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +00:00
fix complex, rational
This commit is contained in:
parent
cdb10c0fbe
commit
6b3f7ad894
19 changed files with 1568 additions and 1360 deletions
24
sprout/rational/values.hpp
Normal file
24
sprout/rational/values.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef SPROUT_RATIONAL_VALUES_HPP
|
||||
#define SPROUT_RATIONAL_VALUES_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/rational/rational.hpp>
|
||||
#include <sprout/cstdlib/abs.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// abs
|
||||
//
|
||||
template<typename IntType>
|
||||
inline SPROUT_CONSTEXPR sprout::rational<IntType>
|
||||
abs(sprout::rational<IntType> const& x) {
|
||||
return x.numerator() >= IntType(0) ? x
|
||||
: sprout::detail::make_rational<IntType>(
|
||||
-x.numerator(), x.denominator(),
|
||||
sprout::detail::rational_private_constructor_tag()
|
||||
)
|
||||
;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // SPROUT_RATIONAL_VALUES_HPP
|
Loading…
Add table
Add a link
Reference in a new issue