Skip to content

error: floating point classification requires argument of floating point type (passed in 'half_float::half') #2479

@yurivict

Description

@yurivict

std::isnan fails on half_float::half:

In file included from /usr/ports/misc/lbann/work/lbann-0.104/src/operators/math/unary.cpp:27:
In file included from /usr/ports/misc/lbann/work/lbann-0.104/include/lbann/operators/math/unary.hpp:30:
In file included from /usr/ports/misc/lbann/work/lbann-0.104/include/lbann/operators/declare_stateless_op.hpp:29:
In file included from /usr/ports/misc/lbann/work/lbann-0.104/include/lbann/operators/elementwise_operator.hpp:30:
In file included from /usr/ports/misc/lbann/work/lbann-0.104/include/lbann/operators/operator.hpp:30:
In file included from /usr/ports/misc/lbann/work/lbann-0.104/include/lbann/base.hpp:30:
In file included from /usr/local/include/El.hpp:14:
In file included from /usr/local/include/El/core.hpp:16:
In file included from /usr/include/c++/v1/array:152:
In file included from /usr/include/c++/v1/compare:174:
In file included from /usr/include/c++/v1/cmath:327:
In file included from /usr/include/c++/v1/__math/special_functions.h:15:
/usr/include/c++/v1/__math/traits.h:101:26: error: floating point classification requires argument of floating point type (passed in 'half_float::half')
  101 |   return __builtin_isnan(__x);
      |                          ^~~
/usr/ports/misc/lbann/work/lbann-0.104/src/operators/math/unary.cpp:47:65: note: in instantiation of function template specialization 'std::__math::isnan<half_float::half, 0>' requested here
   47 |     const auto& b = x != El::TypeTraits<DataT>::Zero() && !std::isnan(x);
      |                                                                 ^
/usr/include/c++/v1/__type_traits/invoke.h:150:25: note: in instantiation of member function 'lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>::operator()' requested here
  150 |                { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
      |                         ^
/usr/include/c++/v1/__functional/function.h:171:22: note: in instantiation of function template specialization 'std::__invoke_void_return_wrapper<half_float::half>::__call<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half> &, const half_float::half &>' requested here
  171 |     return _Invoker::__call(__f_.first(), std::forward<_ArgTypes>(__arg)...);
      |                      ^
/usr/include/c++/v1/__functional/function.h:313:10: note: in instantiation of member function 'std::__function::__alloc_func<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>, std::allocator<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>>, half_float::half (const half_float::half &)>::operator()' requested here
  313 |   return __f_(std::forward<_ArgTypes>(__arg)...);
      |          ^
/usr/include/c++/v1/__functional/function.h:268:34: note: in instantiation of member function 'std::__function::__func<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>, std::allocator<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>>, half_float::half (const half_float::half &)>::operator()' requested here
  268 |   _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f, _Alloc&& __a) : __f_(std::move(__f), std::move(__a)) {}
      |                                  ^
/usr/include/c++/v1/__functional/function.h:361:39: note: in instantiation of member function 'std::__function::__func<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>, std::allocator<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>>, half_float::half (const half_float::half &)>::__func' requested here
  361 |         __f_ = ::new ((void*)&__buf_) _Fun(std::move(__f), _Alloc(__af));
      |                                       ^
/usr/include/c++/v1/__functional/function.h:372:60: note: in instantiation of function template specialization 'std::__function::__value_func<half_float::half (const half_float::half &)>::__value_func<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>, std::allocator<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>>>' requested here
  372 |   _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f) : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
      |                                                            ^
/usr/include/c++/v1/__functional/function.h:946:50: note: in instantiation of function template specialization 'std::__function::__value_func<half_float::half (const half_float::half &)>::__value_func<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>, 0>' requested here
  946 | function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(std::move(__f)) {}
      |                                                  ^
/usr/ports/misc/lbann/work/lbann-0.104/src/operators/math/unary.cpp:550:1: note: in instantiation of function template specialization 'std::function<half_float::half (const half_float::half &)>::function<lbann::(anonymous namespace)::LogicalNotOpImpl<half_float::half>, void>' requested here
  550 | DEFINE_COMPUTE_OPS(LogicalNot)
      | ^
/usr/ports/misc/lbann/work/lbann-0.104/src/operators/math/unary.cpp:513:7: note: expanded from macro 'DEFINE_COMPUTE_OPS'
  513 |       std::function<DataT(DataT const&)>(OP_NAME##OpImpl<DataT>{}));           \
      |       ^
1 error generated.

Version: 1.104
clang-18
FreeBSD 14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions