#include <stdint.h>
#ifdef CORE_MATH_SUPPORT_ERRNO
#include <errno.h>
#endif
#include <math.h>
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#endif
#pragma STDC FENV_ACCESS ON
typedef union {double f; uint64_t u;} b64u64_u;
__bf16 cr_hypot_bf16(__bf16 x, __bf16 y){
b64u64_u tx = {.f = x};
b64u64_u ty = {.f = y};
double z = __builtin_sqrt (tx.f * tx.f + ty.f * ty.f);
__bf16 ret = z;
#ifdef CORE_MATH_SUPPORT_ERRNO
if (z != 0 && (double) ret != z && z < 0x1p-126) {
int t = 1.0f + 0x1p-24f > 1.0f; // true for rndu only
int u = 1.0f - 0x1p-25f < 1.0f; // true for rndz/rndd only
if (u || (z < 0x1.ffp-127 && !t) || (z <= 0x1.fep-127 && t))
errno = ERANGE; }
if (z > 0x1.fep+127 && z < 0x1p129) {
int t = 1.0f + 0x1p-24f > 1.0f; // true for rndu only
int u = 1.0f - 0x1p-25f < 1.0f; // true for rndz/rndd only
if (t || (z >= 0x1.ffp+127 && !u) || (z >= 0x1p+128 && u))
errno = ERANGE; }
#endif
return ret;
}
__bf16 hypot_bf16 (__bf16 x, __bf16 y) {
return (__bf16) hypotf ((float) x, (float) y);
}