diff --git a/ndnboost/math/special_functions/sign.hpp b/ndnboost/math/special_functions/sign.hpp
new file mode 100644
index 0000000..fecacfb
--- /dev/null
+++ b/ndnboost/math/special_functions/sign.hpp
@@ -0,0 +1,150 @@
+//  (C) Copyright John Maddock 2006.
+//  (C) Copyright Johan Rade 2006.
+//  (C) Copyright Paul A. Bristow 2011 (added changesign).
+
+//  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 <ndnboost/math/tools/config.hpp>
+#include <ndnboost/math/special_functions/math_fwd.hpp>
+#include <ndnboost/math/special_functions/detail/fp_traits.hpp>
+
+namespace ndnboost{ namespace math{ 
+
+namespace detail {
+
+  // signbit
+
+#ifdef BOOST_MATH_USE_STD_FPCLASSIFY
+    template<class T> 
+    inline int signbit_impl(T x, native_tag const&)
+    {
+        return (std::signbit)(x);
+    }
+#endif
+
+    template<class T> 
+    inline int signbit_impl(T x, generic_tag<true> const&)
+    {
+        return x < 0;
+    }
+
+    template<class T> 
+    inline int signbit_impl(T x, generic_tag<false> const&)
+    {
+        return x < 0;
+    }
+
+    template<class T> 
+    inline int signbit_impl(T x, ieee_copy_all_bits_tag const&)
+    {
+        typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
+
+        BOOST_DEDUCED_TYPENAME traits::bits a;
+        traits::get_bits(x,a);
+        return a & traits::sign ? 1 : 0;
+    }
+
+    template<class T> 
+    inline int signbit_impl(T x, ieee_copy_leading_bits_tag const&)
+    {
+        typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
+
+        BOOST_DEDUCED_TYPENAME traits::bits a;
+        traits::get_bits(x,a);
+
+        return a & traits::sign ? 1 : 0;
+    }
+
+    // Changesign
+
+    template<class T>
+    inline T (changesign_impl)(T x, generic_tag<true> const&)
+    {
+        return -x;
+    }
+
+    template<class T>
+    inline T (changesign_impl)(T x, generic_tag<false> const&)
+    {
+        return -x;
+    }
+
+
+    template<class T>
+    inline T changesign_impl(T x, ieee_copy_all_bits_tag const&)
+    {
+        typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::sign_change_type traits;
+
+        BOOST_DEDUCED_TYPENAME traits::bits a;
+        traits::get_bits(x,a);
+        a ^= traits::sign;
+        traits::set_bits(x,a);
+        return x;
+    }
+
+    template<class T>
+    inline T (changesign_impl)(T x, ieee_copy_leading_bits_tag const&)
+    {
+        typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::sign_change_type traits;
+
+        BOOST_DEDUCED_TYPENAME traits::bits a;
+        traits::get_bits(x,a);
+        a ^= traits::sign;
+        traits::set_bits(x,a);
+        return x;
+    }
+
+
+}   // namespace detail
+
+template<class T> int (signbit)(T x)
+{ 
+   typedef typename detail::fp_traits<T>::type traits;
+   typedef typename traits::method method;
+   // typedef typename ndnboost::is_floating_point<T>::type fp_tag;
+   typedef typename tools::promote_args<T>::type result_type;
+   return detail::signbit_impl(static_cast<result_type>(x), method());
+}
+
+template <class T>
+inline int sign BOOST_NO_MACRO_EXPAND(const T& z)
+{
+   return (z == 0) ? 0 : (ndnboost::math::signbit)(z) ? -1 : 1;
+}
+
+template <class T> typename tools::promote_args<T>::type (changesign)(const T& x)
+{ //!< \brief return unchanged binary pattern of x, except for change of sign bit. 
+   typedef typename detail::fp_traits<T>::sign_change_type traits;
+   typedef typename traits::method method;
+   // typedef typename ndnboost::is_floating_point<T>::type fp_tag;
+   typedef typename tools::promote_args<T>::type result_type;
+
+   return detail::changesign_impl(static_cast<result_type>(x), method());
+}
+
+template <class T, class U>
+inline typename tools::promote_args<T, U>::type 
+   copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y)
+{
+   BOOST_MATH_STD_USING
+   typedef typename tools::promote_args<T, U>::type result_type;
+   return (ndnboost::math::signbit)(static_cast<result_type>(x)) != (ndnboost::math::signbit)(static_cast<result_type>(y)) 
+      ? (ndnboost::math::changesign)(static_cast<result_type>(x)) : static_cast<result_type>(x);
+}
+
+} // namespace math
+} // namespace ndnboost
+
+
+#endif // BOOST_MATH_TOOLS_SIGN_HPP
+
+
