MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / fpclassify

Function fpclassify

include/half_float/half.hpp:4357–4364  ·  view source on GitHub ↗

Classify floating-point value. See also:** Documentation for [std::fpclassify](https://en.cppreference.com/w/cpp/numeric/math/fpclassify). \param arg number to classify \retval FP_ZERO for positive and negative zero \retval FP_SUBNORMAL for subnormal numbers \retval FP_INFINITY for positive and negative infinity \retval FP_NAN for NaNs \retval FP_NORMAL for all other (normal) values

Source from the content-addressed store, hash-verified

4355 /// \retval FP_NAN for NaNs
4356 /// \retval FP_NORMAL for all other (normal) values
4357 inline HALF_CONSTEXPR int fpclassify(half arg)
4358 {
4359 return !(arg.data_&0x7FFF) ? FP_ZERO :
4360 ((arg.data_&0x7FFF)<0x400) ? FP_SUBNORMAL :
4361 ((arg.data_&0x7FFF)<0x7C00) ? FP_NORMAL :
4362 ((arg.data_&0x7FFF)==0x7C00) ? FP_INFINITE :
4363 FP_NAN;
4364 }
4365
4366 /// Check if finite number.
4367 /// **See also:** Documentation for [std::isfinite](https://en.cppreference.com/w/cpp/numeric/math/isfinite).

Callers 1

bfloat16_tClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected