fpclassify.c (141379) | fpclassify.c (283694) |
---|---|
1/*- 2 * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org> 3 * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org> 3 * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/lib/libc/gen/fpclassify.c 141379 2005-02-06 03:23:31Z das $ | 27 * $FreeBSD: head/lib/libc/gen/fpclassify.c 283694 2015-05-29 09:26:10Z andrew $ |
28 */ 29 30#include <sys/endian.h> 31 | 28 */ 29 30#include <sys/endian.h> 31 |
32#include <machine/float.h> 33 |
|
32#include <math.h> 33#include <stdint.h> 34 35#include "fpmath.h" 36 37int 38__fpclassifyf(float f) 39{ --- 39 unchanged lines hidden (view full) --- 79 80 u.e = e; 81 if (u.bits.exp == 0) { 82 if ((u.bits.manl | u.bits.manh) == 0) 83 return (FP_ZERO); 84 return (FP_SUBNORMAL); 85 } 86 mask_nbit_l(u); /* Mask normalization bit if applicable. */ | 34#include <math.h> 35#include <stdint.h> 36 37#include "fpmath.h" 38 39int 40__fpclassifyf(float f) 41{ --- 39 unchanged lines hidden (view full) --- 81 82 u.e = e; 83 if (u.bits.exp == 0) { 84 if ((u.bits.manl | u.bits.manh) == 0) 85 return (FP_ZERO); 86 return (FP_SUBNORMAL); 87 } 88 mask_nbit_l(u); /* Mask normalization bit if applicable. */ |
89#if LDBL_MANT_DIG == 53 90 if (u.bits.exp == 2047) { 91 if ((u.bits.manl | u.bits.manh) == 0) 92 return (FP_INFINITE); 93 return (FP_NAN); 94 } 95#else |
|
87 if (u.bits.exp == 32767) { 88 if ((u.bits.manl | u.bits.manh) == 0) 89 return (FP_INFINITE); 90 return (FP_NAN); 91 } | 96 if (u.bits.exp == 32767) { 97 if ((u.bits.manl | u.bits.manh) == 0) 98 return (FP_INFINITE); 99 return (FP_NAN); 100 } |
101#endif |
|
92 return (FP_NORMAL); 93} | 102 return (FP_NORMAL); 103} |