1570af302Sopenharmony_ci#include <math.h> 2570af302Sopenharmony_ci#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 3570af302Sopenharmony_cilong double logbl(long double x) 4570af302Sopenharmony_ci{ 5570af302Sopenharmony_ci return logb(x); 6570af302Sopenharmony_ci} 7570af302Sopenharmony_ci#else 8570af302Sopenharmony_cilong double logbl(long double x) 9570af302Sopenharmony_ci{ 10570af302Sopenharmony_ci if (!isfinite(x)) 11570af302Sopenharmony_ci return x * x; 12570af302Sopenharmony_ci if (x == 0) 13570af302Sopenharmony_ci return -1/(x*x); 14570af302Sopenharmony_ci return ilogbl(x); 15570af302Sopenharmony_ci} 16570af302Sopenharmony_ci#endif 17