1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/* Copyright (C) 1993 Olaf Flebbe
This file is part of the Linux C Library.
The Linux C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Linux C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. */
/* YES: DO NOT INCLUDE ANY HEADER FILES.
TYPE CONVERTING, YUCK! */
/*
THIS FUNCTION IS STILL EXPERIMENTAL AND/OR OBSOLETE
Olaf Flebbe 1/96
*/
#define FP_NAN 1
#define FP_INFINITE 2
#define FP_NORMAL 3
#define FP_SUBNORMAL 4
#define FP_ZERO 5
int fpclassifyf( unsigned int x) {
unsigned int y;
x <<= 1;
y = x & 0xff000000;
x = x & 0x00ffffff;
if (y == 0xff000000) {
/* i.e. NaN or Inf */
if (x)
return FP_NAN;
else
return FP_INFINITE;
} else if (y)
return FP_NORMAL;
else if (x)
return FP_SUBNORMAL;
else
return FP_ZERO;
}
int fpclassifyd( unsigned int x2, unsigned int x1) {
unsigned int y;
y = x1 & 0x7ff00000;
x1 = (x1 & 0x000fffff)| x2;
if (y == 0x7ff00000) {
/* i.e. NaN or Inf */
if (x1)
return FP_NAN;
else
return FP_INFINITE;
} else if (y)
return FP_NORMAL;
else if (x1)
return FP_SUBNORMAL;
else
return FP_ZERO;
}
int fpclassifyl( unsigned int x3, unsigned int x2,
unsigned int x1) {
unsigned int y;
y = x1 & 0x00007fff;
x1 = (x2 & 0x7fffffff) | x3;
if (y == 0x00007fff) {
/* i.e. NaN or Inf */
if (x1)
return FP_NAN;
else
return FP_INFINITE;
} else if (y)
return FP_NORMAL;
else if (x1)
return FP_SUBNORMAL; /* WHAT ABOUT PSEUDODENORMALS ???????? */
else
return FP_ZERO;
}
|