sign.hpp
来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 44 行
HPP
44 行
// (C) Copyright John Maddock 2006.// Use, modification and distribution are subject to 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)#ifndef BOOST_MATH_TOOLS_SIGN_HPP#define BOOST_MATH_TOOLS_SIGN_HPP#ifdef _MSC_VER#pragma once#endif#include <boost/math/tools/config.hpp>#include <boost/math/special_functions/math_fwd.hpp>namespace boost{ namespace math{ template <class T>inline int sign BOOST_NO_MACRO_EXPAND(const T& z){ return (z == 0) ? 0 : (z < 0) ? -1 : 1;}template <class T>inline int signbit BOOST_NO_MACRO_EXPAND(const T& z){ return (z < 0) ? 1 : 0;}template <class T>inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y){ BOOST_MATH_STD_USING return fabs(x) * boost::math::sign(y);}} // namespace math} // namespace boost#endif // BOOST_MATH_TOOLS_SIGN_HPP
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?