Skip to content

Commit

Permalink
Make __float128 a floating point type.
Browse files Browse the repository at this point in the history
Allows float128 to be used in non gnu mode.
Enable some tests for non-gnu mode.
Fixes #569.
  • Loading branch information
jzmaddock committed Sep 7, 2024
1 parent 0ab75f9 commit 2b80178
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ mp-run-simple has_mpc.cpp mpc mpfr gmp : : :
mp-run-simple has_tommath.cpp tommath : : :
<include>$(tommath_path) : has_tommath ;
mp-run-simple has_float128.cpp quadmath : : : : has_float128 ;
mp-run-simple has_basic_float128.cpp quadmath : : : : has_basic_float128 ;
exe has_intel_quad : has_intel_quad.cpp : <cxxflags>-Qoption,cpp,--extended_float_type ;
exe has_eigen : has_eigen.cpp ;
exe has_f2c : has_f2c.cpp f2c ;
Expand All @@ -83,6 +84,7 @@ explicit has_mpfr ;
explicit has_mpfi ;
explicit has_tommath ;
explicit has_float128 ;
explicit has_basic_float128 ;
explicit has_intel_quad ;
explicit has_mpc ;
explicit has_eigen ;
Expand Down
16 changes: 16 additions & 0 deletions config/has_basic_float128.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright John Maddock 2024.
// 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)

#include <boost/config.hpp>

extern "C" __float128 sqrtq(__float128);

int main()
{
__float128 f = 0;
f = sqrtq(f);

return 0;
}
5 changes: 5 additions & 0 deletions include/boost/multiprecision/detail/number_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,11 @@ struct number_category<number<Backend, ExpressionTemplates> > : public number_ca
template <class tag, class A1, class A2, class A3, class A4>
struct number_category<detail::expression<tag, A1, A2, A3, A4> > : public number_category<typename detail::expression<tag, A1, A2, A3, A4>::result_type>
{};
#if defined(__SIZEOF_FLOAT128__)
template <>
struct number_category<__float128> : public std::integral_constant<int, number_kind_floating_point> {};
#endif

//
// Specializations for types which do not always have numberic_limits specializations:
//
Expand Down
5 changes: 5 additions & 0 deletions include/boost/multiprecision/traits/std_integer_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ struct make_unsigned : public std::make_unsigned<T> {};
template <class T>
struct make_signed : public std::make_signed<T> {};

#if defined(__SIZEOF_FLOAT128__)
template <>
struct is_arithmetic<__float128> : public std::true_type {};
#endif

#ifdef BOOST_HAS_INT128

template <>
Expand Down
2 changes: 1 addition & 1 deletion test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ test-suite arithmetic_tests :

[ run test_arithmetic_mpfi_50.cpp mpfi mpfr gmp no_eh_support : : : [ check-target-builds ../config//has_mpfi : : <build>no ] [ check-target-builds ../config//has_float128 : <source>quadmath ] ]

[ run test_arithmetic_float_128.cpp quadmath no_eh_support : : : [ check-target-builds ../config//has_float128 : : <build>no ] ]
[ run test_arithmetic_float_128.cpp quadmath no_eh_support : : : [ check-target-builds ../config//has_basic_float128 : : <build>no ] ]
[ run test_arithmetic_float_128.cpp no_eh_support : : : [ check-target-builds ../config//has_intel_quad : <cxxflags>-Qoption,cpp,--extended_float_type : <build>no ] [ check-target-builds ../config//has_float128 : <source>quadmath ] : test_arithmetic_intel_quad ]

[ run test_arithmetic_mpc.cpp mpc mpfr gmp : : : [ check-target-builds ../config//has_mpc : : <build>no ] [ check-target-builds ../config//has_float128 : <source>quadmath ] ]
Expand Down

0 comments on commit 2b80178

Please sign in to comment.