summaryrefslogtreecommitdiffstats
path: root/libm/src/s_ilogbl.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:13 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:13 -0800
commit1767f908af327fa388b1c66883760ad851267013 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /libm/src/s_ilogbl.c
parenta799b53f10e5a6fd51fef4436cfb7ec99836a516 (diff)
downloadbionic-1767f908af327fa388b1c66883760ad851267013.zip
bionic-1767f908af327fa388b1c66883760ad851267013.tar.gz
bionic-1767f908af327fa388b1c66883760ad851267013.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'libm/src/s_ilogbl.c')
-rw-r--r--libm/src/s_ilogbl.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/libm/src/s_ilogbl.c b/libm/src/s_ilogbl.c
deleted file mode 100644
index 406ad56..0000000
--- a/libm/src/s_ilogbl.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * From: @(#)s_ilogb.c 5.1 93/09/24
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#ifndef lint
-static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_ilogbl.c,v 1.1 2004/10/11 18:13:52 stefanf Exp $";
-#endif
-
-#include <float.h>
-#include <limits.h>
-#include <math.h>
-
-#include "fpmath.h"
-
-int
-ilogbl(long double x)
-{
- union IEEEl2bits u;
- unsigned long m;
- int b;
-
- u.e = x;
- if (u.bits.exp == 0) {
- if ((u.bits.manl | u.bits.manh) == 0)
- return (FP_ILOGB0);
- /* denormalized */
- if (u.bits.manh == 0) {
- m = 1lu << (LDBL_MANL_SIZE - 1);
- for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1)
- b++;
- } else {
- m = 1lu << (LDBL_MANH_SIZE - 1);
- for (b = 0; !(u.bits.manh & m); m >>= 1)
- b++;
- }
-#ifdef LDBL_IMPLICIT_NBIT
- b++;
-#endif
- return (LDBL_MIN_EXP - b - 1);
- } else if (u.bits.exp < (LDBL_MAX_EXP << 1) - 1)
- return (u.bits.exp - LDBL_MAX_EXP + 1);
- else if (u.bits.manl != 0 || u.bits.manh != 0)
- return (FP_ILOGBNAN);
- else
- return (INT_MAX);
-}